当前位置: 首页>>代码示例>>C++>>正文


C++ register_shrinker函数代码示例

本文整理汇总了C++中register_shrinker函数的典型用法代码示例。如果您正苦于以下问题:C++ register_shrinker函数的具体用法?C++ register_shrinker怎么用?C++ register_shrinker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了register_shrinker函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lowmem_init

static int __init lowmem_init(void)
{
	task_free_register(&task_free_nb);
	task_fork_register(&task_fork_nb);
	register_shrinker(&lowmem_shrinker);
	return 0;
}
开发者ID:niker,项目名称:EliteKernel-Blade-Rebase,代码行数:7,代码来源:lowmemorykiller.c

示例2: kgsl_heap_init

int kgsl_heap_init(void)
{
	int i;

	for (i = 0; i < num_orders; i++) {
		struct kgsl_page_pool *pool;
		gfp_t gfp_flags = low_order_gfp_flags;

		if (orders[i] > 4)
			gfp_flags = high_order_gfp_flags;
		pool = kgsl_page_pool_create(gfp_flags, orders[i], orders_reserved[i], reserve_only[i]);
		if (!pool)
			goto destroy_pools;
		kgsl_heap.pools[i] = pool;
	}

	kgsl_heap.shrinker.shrink = kgsl_heap_shrink;
	kgsl_heap.shrinker.seeks = DEFAULT_SEEKS;
	kgsl_heap.shrinker.batch = 0;
	register_shrinker(&kgsl_heap.shrinker);

	return 0;

destroy_pools:
	while (i--)
		kgsl_page_pool_destroy(kgsl_heap.pools[i]);
	return -ENOMEM;
}
开发者ID:crimsonthunder,项目名称:Samsung_mm,代码行数:28,代码来源:kgsl_heap.c

示例3: init_cifs_idmap

int
init_cifs_idmap(void)
{
    struct cred *cred;
    struct key *keyring;
    int ret;

    cFYI(1, "Registering the %s key type\n", cifs_idmap_key_type.name);

    /* create an override credential set with a special thread keyring in
     * which requests are cached
     *
     * this is used to prevent malicious redirections from being installed
     * with add_key().
     */
    cred = prepare_kernel_cred(NULL);
    if (!cred)
        return -ENOMEM;

    keyring = keyring_alloc(".cifs_idmap", 0, 0, cred,
                            (KEY_POS_ALL & ~KEY_POS_SETATTR) |
                            KEY_USR_VIEW | KEY_USR_READ,
                            KEY_ALLOC_NOT_IN_QUOTA, NULL);
    if (IS_ERR(keyring)) {
        ret = PTR_ERR(keyring);
        goto failed_put_cred;
    }

    ret = register_key_type(&cifs_idmap_key_type);
    if (ret < 0)
        goto failed_put_key;

    /* instruct request_key() to use this special keyring as a cache for
     * the results it looks up */
    set_bit(KEY_FLAG_ROOT_CAN_CLEAR, &keyring->flags);
    cred->thread_keyring = keyring;
    cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING;
    root_cred = cred;

    spin_lock_init(&siduidlock);
    uidtree = RB_ROOT;
    spin_lock_init(&sidgidlock);
    gidtree = RB_ROOT;

    spin_lock_init(&uidsidlock);
    siduidtree = RB_ROOT;
    spin_lock_init(&gidsidlock);
    sidgidtree = RB_ROOT;
    register_shrinker(&cifs_shrinker);

    cFYI(1, "cifs idmap keyring: %d\n", key_serial(keyring));
    return 0;

failed_put_key:
    key_put(keyring);
failed_put_cred:
    put_cred(cred);
    return ret;
}
开发者ID:Emineminero,项目名称:DORIMANX_LG_STOCK_LP_KERNEL,代码行数:59,代码来源:cifsacl.c

示例4: virtio_balloon_register_shrinker

static int virtio_balloon_register_shrinker(struct virtio_balloon *vb)
{
	vb->shrinker.scan_objects = virtio_balloon_shrinker_scan;
	vb->shrinker.count_objects = virtio_balloon_shrinker_count;
	vb->shrinker.seeks = DEFAULT_SEEKS;

	return register_shrinker(&vb->shrinker);
}
开发者ID:markus-oberhumer,项目名称:linux,代码行数:8,代码来源:virtio_balloon.c

示例5: lowmem_init

static int __init lowmem_init(void)
{
#ifdef CONFIG_DUMP_TASKS_ON_NOPAGE
	timeout = jiffies + 1200 * HZ;
#endif
	register_shrinker(&lowmem_shrinker);
	return 0;
}
开发者ID:MuMu360121,项目名称:jordan-kernel,代码行数:8,代码来源:lowmemorykiller.c

示例6: xfs_inode_shrinker_register

void
xfs_inode_shrinker_register(
	struct xfs_mount	*mp)
{
	mp->m_inode_shrink.shrink = xfs_reclaim_inode_shrink;
	mp->m_inode_shrink.seeks = DEFAULT_SEEKS;
	register_shrinker(&mp->m_inode_shrink);
}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:8,代码来源:xfs_sync.c

示例7: lowmem_init

static int __init lowmem_init(void)
{
#ifdef CONFIG_MACH_LGE
	task_free_register(&task_nb);
#endif
	register_shrinker(&lowmem_shrinker);
	return 0;
}
开发者ID:ChangYeoun,项目名称:10.1,代码行数:8,代码来源:lowmemorykiller.c

示例8: lowmem_init

static int __init lowmem_init(void)
{
	register_shrinker(&lowmem_shrinker);
#ifdef CONFIG_MEMORY_HOTPLUG
	hotplug_memory_notifier(lmk_hotplug_callback, 0);
#endif
	return 0;
}
开发者ID:Snuzzo,项目名称:funky_kernel,代码行数:8,代码来源:lowmemorykiller.c

示例9: lowmem_init

static int __init lowmem_init(void)
{
	register_shrinker(&lowmem_shrinker);
#ifdef CONFIG_SEC_OOM_KILLER
	register_oom_notifier(&android_oom_notifier);
#endif

	return 0;
}
开发者ID:GaHoKwan,项目名称:Samsung_kernel_klte_Lollipop,代码行数:9,代码来源:lowmemorykiller.c

示例10: reiser4_init_d_cursor

/**
 * reiser4_init_d_cursor - create d_cursor cache
 *
 * Initializes slab cache of d_cursors. It is part of reiser4 module
 * initialization.
 */
int reiser4_init_d_cursor(void)
{
	d_cursor_cache = kmem_cache_create("d_cursor", sizeof(dir_cursor), 0,
					   SLAB_HWCACHE_ALIGN, NULL);
	if (d_cursor_cache == NULL)
		return RETERR(-ENOMEM);

	register_shrinker(&d_cursor_shrinker);
	return 0;
}
开发者ID:mgross029,项目名称:android_kernel,代码行数:16,代码来源:fsdata.c

示例11: init_cifs_idmap

int
init_cifs_idmap(void)
{
	struct cred *cred;
	struct key *keyring;
	int ret;

	cFYI(1, "Registering the %s key type\n", cifs_idmap_key_type.name);

	cred = prepare_kernel_cred(NULL);
	if (!cred)
		return -ENOMEM;

	keyring = key_alloc(&key_type_keyring, ".cifs_idmap", 0, 0, cred,
			    (KEY_POS_ALL & ~KEY_POS_SETATTR) |
			    KEY_USR_VIEW | KEY_USR_READ,
			    KEY_ALLOC_NOT_IN_QUOTA);
	if (IS_ERR(keyring)) {
		ret = PTR_ERR(keyring);
		goto failed_put_cred;
	}

	ret = key_instantiate_and_link(keyring, NULL, 0, NULL, NULL);
	if (ret < 0)
		goto failed_put_key;

	ret = register_key_type(&cifs_idmap_key_type);
	if (ret < 0)
		goto failed_put_key;

	set_bit(KEY_FLAG_ROOT_CAN_CLEAR, &keyring->flags);
	cred->thread_keyring = keyring;
	cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING;
	root_cred = cred;

	spin_lock_init(&siduidlock);
	uidtree = RB_ROOT;
	spin_lock_init(&sidgidlock);
	gidtree = RB_ROOT;

	spin_lock_init(&uidsidlock);
	siduidtree = RB_ROOT;
	spin_lock_init(&gidsidlock);
	sidgidtree = RB_ROOT;
	register_shrinker(&cifs_shrinker);

	cFYI(1, "cifs idmap keyring: %d\n", key_serial(keyring));
	return 0;

failed_put_key:
	key_put(keyring);
failed_put_cred:
	put_cred(cred);
	return ret;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:55,代码来源:cifsacl.c

示例12: lowmem_init

static int __init lowmem_init(void)
{
	//task_free_register(&task_nb);
#if CONFIG_MSM_KGSL_VM_THRESHOLD > 0
       extern void kgsl_register_shrinker(void (*shrink)(int largest, int threshold));

       kgsl_register_shrinker(lowmem_vm_shrinker);
#endif
	register_shrinker(&lowmem_shrinker);
#ifdef CONFIG_MEMORY_HOTPLUG
	hotplug_memory_notifier(lmk_hotplug_callback, 0);
#endif
	return 0;
}
开发者ID:mblaster,项目名称:android_kernel_huawei_hws7300u,代码行数:14,代码来源:lowmemorykiller.c

示例13: sptlrpc_enc_pool_init

int sptlrpc_enc_pool_init(void)
{
	/*
	 * maximum capacity is 1/8 of total physical memory.
	 * is the 1/8 a good number?
	 */
	page_pools.epp_max_pages = totalram_pages / 8;
	page_pools.epp_max_pools = npages_to_npools(page_pools.epp_max_pages);

	init_waitqueue_head(&page_pools.epp_waitq);
	page_pools.epp_waitqlen = 0;
	page_pools.epp_pages_short = 0;

	page_pools.epp_growing = 0;

	page_pools.epp_idle_idx = 0;
	page_pools.epp_last_shrink = ktime_get_seconds();
	page_pools.epp_last_access = ktime_get_seconds();

	spin_lock_init(&page_pools.epp_lock);
	page_pools.epp_total_pages = 0;
	page_pools.epp_free_pages = 0;

	page_pools.epp_st_max_pages = 0;
	page_pools.epp_st_grows = 0;
	page_pools.epp_st_grow_fails = 0;
	page_pools.epp_st_shrinks = 0;
	page_pools.epp_st_access = 0;
	page_pools.epp_st_missings = 0;
	page_pools.epp_st_lowfree = 0;
	page_pools.epp_st_max_wqlen = 0;
	page_pools.epp_st_max_wait = 0;
	page_pools.epp_st_outofmem = 0;

	enc_pools_alloc();
	if (!page_pools.epp_pools)
		return -ENOMEM;

	register_shrinker(&pools_shrinker);

	return 0;
}
开发者ID:asmalldev,项目名称:linux,代码行数:42,代码来源:sec_bulk.c

示例14: workingset_init

static int __init workingset_init(void)
{
	register_shrinker(&workingset_shadow_shrinker);
	return 0;
}
开发者ID:spacex,项目名称:kernel-centos7,代码行数:5,代码来源:workingset.c

示例15: init_gfs2_fs

static int __init init_gfs2_fs(void)
{
	int error;

	gfs2_str2qstr(&gfs2_qdot, ".");
	gfs2_str2qstr(&gfs2_qdotdot, "..");
	gfs2_quota_hash_init();

	error = gfs2_sys_init();
	if (error)
		return error;

	error = list_lru_init(&gfs2_qd_lru);
	if (error)
		goto fail_lru;

	error = gfs2_glock_init();
	if (error)
		goto fail;

	error = -ENOMEM;
	gfs2_glock_cachep = kmem_cache_create("gfs2_glock",
					      sizeof(struct gfs2_glock),
					      0, 0,
					      gfs2_init_glock_once);
	if (!gfs2_glock_cachep)
		goto fail;

	gfs2_glock_aspace_cachep = kmem_cache_create("gfs2_glock(aspace)",
					sizeof(struct gfs2_glock) +
					sizeof(struct address_space),
					0, 0, gfs2_init_gl_aspace_once);

	if (!gfs2_glock_aspace_cachep)
		goto fail;

	gfs2_inode_cachep = kmem_cache_create("gfs2_inode",
					      sizeof(struct gfs2_inode),
					      0,  SLAB_RECLAIM_ACCOUNT|
					          SLAB_MEM_SPREAD,
					      gfs2_init_inode_once);
	if (!gfs2_inode_cachep)
		goto fail;

	gfs2_bufdata_cachep = kmem_cache_create("gfs2_bufdata",
						sizeof(struct gfs2_bufdata),
					        0, 0, NULL);
	if (!gfs2_bufdata_cachep)
		goto fail;

	gfs2_rgrpd_cachep = kmem_cache_create("gfs2_rgrpd",
					      sizeof(struct gfs2_rgrpd),
					      0, 0, NULL);
	if (!gfs2_rgrpd_cachep)
		goto fail;

	gfs2_quotad_cachep = kmem_cache_create("gfs2_quotad",
					       sizeof(struct gfs2_quota_data),
					       0, 0, NULL);
	if (!gfs2_quotad_cachep)
		goto fail;

	gfs2_rsrv_cachep = kmem_cache_create("gfs2_mblk",
					     sizeof(struct gfs2_blkreserv),
					       0, 0, NULL);
	if (!gfs2_rsrv_cachep)
		goto fail;

	register_shrinker(&gfs2_qd_shrinker);

	error = register_filesystem(&gfs2_fs_type);
	if (error)
		goto fail;

	error = register_filesystem(&gfs2meta_fs_type);
	if (error)
		goto fail_unregister;

	error = -ENOMEM;
	gfs_recovery_wq = alloc_workqueue("gfs_recovery",
					  WQ_MEM_RECLAIM | WQ_FREEZABLE, 0);
	if (!gfs_recovery_wq)
		goto fail_wq;

	gfs2_control_wq = alloc_workqueue("gfs2_control",
					  WQ_UNBOUND | WQ_FREEZABLE, 0);
	if (!gfs2_control_wq)
		goto fail_recovery;

	gfs2_freeze_wq = alloc_workqueue("freeze_workqueue", 0, 0);

	if (!gfs2_freeze_wq)
		goto fail_control;

	gfs2_page_pool = mempool_create_page_pool(64, 0);
	if (!gfs2_page_pool)
		goto fail_freeze;

	gfs2_register_debugfs();

//.........这里部分代码省略.........
开发者ID:19Dan01,项目名称:linux,代码行数:101,代码来源:main.c


注:本文中的register_shrinker函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。