Ejemplo n.º 1
0
/*
 *函数名称:public_destroy
 *函数功能:public module destroy
 *输入参数:none
 *输出参数:none
 *返回值:  none
*/
void public_destroy()
{
    INFO_PRINT("\n----->Public模块释放..........\n");

    log_destroy();
    mempool_destroy();

    //计数器
    global_shared.retain_count --;
}
Ejemplo n.º 2
0
static void fscrypt_destroy(void)
{
	struct fscrypt_ctx *pos, *n;

	list_for_each_entry_safe(pos, n, &fscrypt_free_ctxs, free_list)
		kmem_cache_free(fscrypt_ctx_cachep, pos);
	INIT_LIST_HEAD(&fscrypt_free_ctxs);
	mempool_destroy(fscrypt_bounce_page_pool);
	fscrypt_bounce_page_pool = NULL;
}
Ejemplo n.º 3
0
void regfree(regex_t *rx)
{
	struct RegexInt *rxi;
	if (rx) {
		rxi = rx->internal;
		if (rxi)
			mempool_destroy(&rxi->pool);
		memset(rx, 0, sizeof(*rx));
	}
}
Ejemplo n.º 4
0
void cleanup_mod(void)
{
printk("\n Module removed");

mempool_free(ptr,mem);
mempool_destroy(mem);
//kmem_cache_free(cache_ptr,ret);
kmem_cache_destroy(cache_ptr);
//mempool_free(ptr,mem);

}
Ejemplo n.º 5
0
void server_do()
{
	recvbuf_pool = mempool_create("RECVBUF", recvbuf_size, 0);
	if(network_tcp_register(&sa, onaccept_proc, NULL)!=ERR_NOERROR) {
		printf("Failed to network_tcp_register.\n");
		exit(0);
	}
	getchar();
	network_tcp_unregister(&sa);
	mempool_destroy(recvbuf_pool);
}
Ejemplo n.º 6
0
static void deadline_exit_queue(elevator_t *e)
{
	struct deadline_data *dd = e->elevator_data;

	BUG_ON(!list_empty(&dd->fifo_list[READ]));
	BUG_ON(!list_empty(&dd->fifo_list[WRITE]));

	mempool_destroy(dd->drq_pool);
	kfree(dd->hash);
	kfree(dd);
}
Ejemplo n.º 7
0
void diagmem_exit(struct diagchar_dev *driver)
{
	if (driver->diagpool) {
		if (driver->count == 0 && driver->ref_count == 0) {
			mempool_destroy(driver->diagpool);
			driver->diagpool = NULL;
		}
	} else
		printk(KERN_ALERT "\n Attempt to free up"
					"non existing COPY pool");

	if (driver->diag_hdlc_pool) {
		if (driver->count_hdlc_pool == 0 && driver->ref_count == 0) {
			mempool_destroy(driver->diag_hdlc_pool);
			driver->diag_hdlc_pool = NULL;
		}
	} else
		printk(KERN_ALERT "\n Attempt to free up"
					 "non existing HDLC pool");
}
Ejemplo n.º 8
0
void Stream5CleanUdp(void)
{
    if ( udp_lws_cache )
        s5stats.udp_prunes = udp_lws_cache->prunes;

    /* Clean up hash table -- delete all sessions */
    DeleteLWSessionCache(udp_lws_cache);
    udp_lws_cache = NULL;

    mempool_destroy(&udp_session_mempool);
}
Ejemplo n.º 9
0
void Stream5CleanIcmp(void)
{
    if ( icmp_lws_cache )
        s5stats.icmp_prunes = icmp_lws_cache->prunes;

    /* Clean up hash table -- delete all sessions */
    DeleteLWSessionCache(icmp_lws_cache);
    icmp_lws_cache = NULL;

    mempool_destroy(&icmp_session_mempool);
}
Ejemplo n.º 10
0
/* alloc_disk and add_disk can sleep */
void
aoeblk_gdalloc(void *vp)
{
	struct aoedev *d = vp;
	struct gendisk *gd;
	ulong flags;

	gd = alloc_disk(AOE_PARTITIONS);
	if (gd == NULL) {
		printk(KERN_ERR
			"aoe: cannot allocate disk structure for %ld.%d\n",
			d->aoemajor, d->aoeminor);
		goto err;
	}

	d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
	if (d->bufpool == NULL) {
		printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%d\n",
			d->aoemajor, d->aoeminor);
		goto err_disk;
	}

	blk_queue_make_request(&d->blkq, aoeblk_make_request);
	if (bdi_init(&d->blkq.backing_dev_info))
		goto err_mempool;
	spin_lock_irqsave(&d->lock, flags);
	gd->major = AOE_MAJOR;
	gd->first_minor = d->sysminor * AOE_PARTITIONS;
	gd->fops = &aoe_bdops;
	gd->private_data = d;
	gd->capacity = d->ssize;
	snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d",
		d->aoemajor, d->aoeminor);

	gd->queue = &d->blkq;
	d->gd = gd;
	d->flags &= ~DEVFL_GDALLOC;
	d->flags |= DEVFL_UP;

	spin_unlock_irqrestore(&d->lock, flags);

	add_disk(gd);
	aoedisk_add_sysfs(d);
	return;

err_mempool:
	mempool_destroy(d->bufpool);
err_disk:
	put_disk(gd);
err:
	spin_lock_irqsave(&d->lock, flags);
	d->flags &= ~DEVFL_GDALLOC;
	spin_unlock_irqrestore(&d->lock, flags);
}
Ejemplo n.º 11
0
static void
cifs_destroy_mids(void)
{
	mempool_destroy(cifs_mid_poolp);
	if (kmem_cache_destroy(cifs_mid_cachep))
		printk(KERN_WARNING
		       "cifs_destroy_mids: error not all structures were freed\n");

	if (kmem_cache_destroy(cifs_oplock_cachep))
		printk(KERN_WARNING
		       "error not all oplock structures were freed\n");
}
Ejemplo n.º 12
0
static void free_dev(struct mapped_device *md)
{
	int minor = md->disk->first_minor;

	if (md->suspended_bdev) {
		thaw_bdev(md->suspended_bdev, NULL);
		bdput(md->suspended_bdev);
	}
	mempool_destroy(md->tio_pool);
	mempool_destroy(md->io_pool);
	del_gendisk(md->disk);
	free_minor(minor);

	spin_lock(&_minor_lock);
	md->disk->private_data = NULL;
	spin_unlock(&_minor_lock);

	put_disk(md->disk);
	blk_cleanup_queue(md->queue);
	module_put(THIS_MODULE);
	kfree(md);
}
Ejemplo n.º 13
0
static void
aoedev_freedev(struct aoedev *d)
{
	if (d->gd) {
		aoedisk_rm_sysfs(d);
		del_gendisk(d->gd);
		put_disk(d->gd);
	}
	kfree(d->frames);
	if (d->bufpool)
		mempool_destroy(d->bufpool);
	kfree(d);
}
Ejemplo n.º 14
0
void __exit mempool_kzalloc_exit(void)  
{  	
	if( element )  	
	{  		
		mempool_kfree(element, pool_data);   //释放内存元素空间  		
		printk("<0>mempool_kfree scessfully!\n");  	
	}  	
	if( pool )  	
	{  		
		mempool_destroy(pool);            //销毁创建的内存池  		
		printk("<0>mempool_destroy scessfully!\n");  	
	} 	  	
	printk("<0>exit!\n");  	
}  
Ejemplo n.º 15
0
void __exit mempool_create_exit(void)  
{  	
	if(pool != NULL) 	
	{ 		
		mempool_destroy(pool);       //销毁创建的内存池 		
		printk("<0>mempool_destroy succeed!\n");	
	} 	
	if(kmem != NULL) 	
	{ 		
		kmem_cache_destroy(kmem);    //销毁创建的slab缓存 		
		printk("<0>kmem_cache_destroy succeed!\n");
	}  	
	printk("<0>exit!\n");  
}
Ejemplo n.º 16
0
static void DNP3CleanExit(int signal, void *data)
{
    if (dnp3_context_id != NULL)
    {
        DNP3FreeConfig(dnp3_context_id);
        dnp3_context_id = NULL;
    }

    if ((dnp3_mempool) && (mempool_destroy(dnp3_mempool) == 0))
    {
        free(dnp3_mempool);
        dnp3_mempool = 0;
    }
}
Ejemplo n.º 17
0
static int resize_pool(unsigned int new_ios)
{
	int r = 0;

	if (_io_pool) {
		if (new_ios == 0) {
			/* free off the pool */
			mempool_destroy(_io_pool);
			_io_pool = NULL;
			bioset_free(_bios);
			_bios = NULL;

		} else {
			/* resize the pool */
			r = mempool_resize(_io_pool, new_ios, GFP_KERNEL);
		}

	} else {
		/* create new pool */
		_io_pool = mempool_create(new_ios, alloc_io, free_io, NULL);
		if (!_io_pool)
			return -ENOMEM;

		_bios = bioset_create(16, 16, 4);
		if (!_bios) {
			mempool_destroy(_io_pool);
			_io_pool = NULL;
			return -ENOMEM;
		}
	}

	if (!r)
		_num_ios = new_ios;

	return r;
}
Ejemplo n.º 18
0
mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn,
                               mempool_free_t *free_fn, void *pool_data,
                               int node_id)
{
        mempool_t *pool;

        pool = __mempool_create(min_nr, alloc_fn, free_fn, pool_data, node_id,
                                sizeof(*pool));

        /* Pre-allocate the guaranteed number of buffers */ 
	 if (mempool_fill(pool, GFP_KERNEL)) {
		mempool_destroy(pool);
		return NULL;
		}
	return pool;
}
Ejemplo n.º 19
0
static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
{
	if (adapter->pool.erp_req)
		mempool_destroy(adapter->pool.erp_req);
	if (adapter->pool.scsi_req)
		mempool_destroy(adapter->pool.scsi_req);
	if (adapter->pool.scsi_abort)
		mempool_destroy(adapter->pool.scsi_abort);
	if (adapter->pool.qtcb_pool)
		mempool_destroy(adapter->pool.qtcb_pool);
	if (adapter->pool.status_read_req)
		mempool_destroy(adapter->pool.status_read_req);
	if (adapter->pool.sr_data)
		mempool_destroy(adapter->pool.sr_data);
	if (adapter->pool.gid_pn)
		mempool_destroy(adapter->pool.gid_pn);
}
Ejemplo n.º 20
0
/**
 * blk_cleanup_queue: - release a &struct request_queue when it is no longer needed
 * @kobj:    the kobj belonging of the request queue to be released
 *
 * Description:
 *     blk_cleanup_queue is the pair to blk_init_queue() or
 *     blk_queue_make_request().  It should be called when a request queue is
 *     being released; typically when a block device is being de-registered.
 *     Currently, its primary task it to free all the &struct request
 *     structures that were allocated to the queue and the queue itself.
 *
 * Caveat:
 *     Hopefully the low level driver will have finished any
 *     outstanding requests first...
 **/
static void blk_release_queue(struct kobject *kobj)
{
	struct request_queue *q =
		container_of(kobj, struct request_queue, kobj);
	struct request_list *rl = &q->rq;

	blk_sync_queue(q);

	if (rl->rq_pool)
		mempool_destroy(rl->rq_pool);

	if (q->queue_tags)
		__blk_queue_free_tags(q);

	blk_trace_shutdown(q);

	bdi_destroy(&q->backing_dev_info);
	kmem_cache_free(blk_requestq_cachep, q);
}
Ejemplo n.º 21
0
int DAL_MessageRelease(void)
{
	dal_msg_control_t*		p_control = &g_dal_msg_contaol;
	int						iret = 0;

	if( !(p_control->init) )
	{
		DAL_ERROR(("not init\n"));
		return -1;
	}
	iret = mempool_destroy( &(p_control->msg_pool));
	if( 0 != iret)
	{
		DAL_ERROR(("mempool_destroy failed\n"));
		return -1;	
	}
	p_control->init = FALSE;	
	return 0;
}
Ejemplo n.º 22
0
static void
aoedev_freedev(struct aoedev *d)
{
	struct aoetgt **t, **e;

	if (d->gd) {
		aoedisk_rm_sysfs(d);
		del_gendisk(d->gd);
		put_disk(d->gd);
	}
	t = d->targets;
	e = t + NTARGETS;
	for (; t < e && *t; t++)
		freetgt(d, *t);
	if (d->bufpool)
		mempool_destroy(d->bufpool);
	skbpoolfree(d);
	kfree(d);
}
Ejemplo n.º 23
0
static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
{
	/* zfcp_data.config_mutex must be held */
	if (adapter->pool.erp_req)
		mempool_destroy(adapter->pool.erp_req);
	if (adapter->pool.scsi_req)
		mempool_destroy(adapter->pool.scsi_req);
	if (adapter->pool.scsi_abort)
		mempool_destroy(adapter->pool.scsi_abort);
	if (adapter->pool.qtcb_pool)
		mempool_destroy(adapter->pool.qtcb_pool);
	if (adapter->pool.status_read_req)
		mempool_destroy(adapter->pool.status_read_req);
	if (adapter->pool.status_read_data)
		mempool_destroy(adapter->pool.status_read_data);
	if (adapter->pool.gid_pn_data)
		mempool_destroy(adapter->pool.gid_pn_data);
}
Ejemplo n.º 24
0
/**
 * ext4_exit_crypto() - Shutdown the ext4 encryption system
 */
void ext4_exit_crypto(void)
{
	struct ext4_crypto_ctx *pos, *n;

	list_for_each_entry_safe(pos, n, &ext4_free_crypto_ctxs, free_list)
		kmem_cache_free(ext4_crypto_ctx_cachep, pos);
	INIT_LIST_HEAD(&ext4_free_crypto_ctxs);
	if (ext4_bounce_page_pool)
		mempool_destroy(ext4_bounce_page_pool);
	ext4_bounce_page_pool = NULL;
	if (ext4_read_workqueue)
		destroy_workqueue(ext4_read_workqueue);
	ext4_read_workqueue = NULL;
	if (ext4_crypto_ctx_cachep)
		kmem_cache_destroy(ext4_crypto_ctx_cachep);
	ext4_crypto_ctx_cachep = NULL;
	if (ext4_crypt_info_cachep)
		kmem_cache_destroy(ext4_crypt_info_cachep);
	ext4_crypt_info_cachep = NULL;
}
Ejemplo n.º 25
0
void
mempool_basic()
{
	int i;
	header();

	mempool_create(&pool, &cache, objsize);

	for (i = 0; i < ITERATIONS_MAX; i++) {
		basic_alloc_streak();
		allocating = ! allocating;
#if 0
		printf("%zu %zu\n", mempool_used(&pool),
		       mempool_total(&pool));
#endif
	}

	mempool_destroy(&pool);

	footer();
}
Ejemplo n.º 26
0
main ()
{
	mempool_t *pool;
	char *test;
	int i;

	pool = mempool_create(NULL, 10, 10);

	printf("Testing mempool\n");
	for (i = 0; i < 10000000; i++) {
		test = (char *)mempool_get_chunk(pool);
		mempool_free_chunk(pool, test);
	}
	mempool_destroy(pool);
	printf("Testing malloc\n");
	for (i = 0; i < 10000000; i++) {
		test = (char *)malloc(10);
		free(test);
	}
	return(0);
}
Ejemplo n.º 27
0
Archivo: aoedev.c Proyecto: 08opt/linux
static void
aoedev_freedev(struct aoedev *d)
{
	struct aoetgt **t, **e;

	cancel_work_sync(&d->work);
	if (d->gd) {
		aoedisk_rm_sysfs(d);
		del_gendisk(d->gd);
		put_disk(d->gd);
	}
	t = d->targets;
	e = t + NTARGETS;
	for (; t < e && *t; t++)
		freetgt(d, *t);
	if (d->bufpool)
		mempool_destroy(d->bufpool);
	skbpoolfree(d);
	blk_cleanup_queue(d->blkq);
	kfree(d);
}
Ejemplo n.º 28
0
static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter)
{
	/* zfcp_data.config_sema must be held */
	if (adapter->pool.fsf_req_erp)
		mempool_destroy(adapter->pool.fsf_req_erp);
	if (adapter->pool.fsf_req_scsi)
		mempool_destroy(adapter->pool.fsf_req_scsi);
	if (adapter->pool.fsf_req_abort)
		mempool_destroy(adapter->pool.fsf_req_abort);
	if (adapter->pool.fsf_req_status_read)
		mempool_destroy(adapter->pool.fsf_req_status_read);
	if (adapter->pool.data_status_read)
		mempool_destroy(adapter->pool.data_status_read);
	if (adapter->pool.data_gid_pn)
		mempool_destroy(adapter->pool.data_gid_pn);
}
Ejemplo n.º 29
0
static void __exit exit_gfs2_fs(void)
{
	unregister_shrinker(&qd_shrinker);
	gfs2_glock_exit();
	gfs2_unregister_debugfs();
	unregister_filesystem(&gfs2_fs_type);
	unregister_filesystem(&gfs2meta_fs_type);
	destroy_workqueue(gfs_recovery_wq);
	destroy_workqueue(gfs2_control_wq);

	rcu_barrier();

	mempool_destroy(gfs2_bh_pool);
	kmem_cache_destroy(gfs2_quotad_cachep);
	kmem_cache_destroy(gfs2_rgrpd_cachep);
	kmem_cache_destroy(gfs2_bufdata_cachep);
	kmem_cache_destroy(gfs2_inode_cachep);
	kmem_cache_destroy(gfs2_glock_aspace_cachep);
	kmem_cache_destroy(gfs2_glock_cachep);

	gfs2_sys_uninit();
}
Ejemplo n.º 30
0
static void
freedev(struct aoedev *d)
{
	struct aoetgt **t, **e;
	int freeing = 0;
	unsigned long flags;

	spin_lock_irqsave(&d->lock, flags);
	if (d->flags & DEVFL_TKILL
	&& !(d->flags & DEVFL_FREEING)) {
		d->flags |= DEVFL_FREEING;
		freeing = 1;
	}
	spin_unlock_irqrestore(&d->lock, flags);
	if (!freeing)
		return;

	del_timer_sync(&d->timer);
	aoedbg_undbg(d);
	if (d->gd) {
		aoedisk_rm_debugfs(d);
		aoedisk_rm_sysfs(d);
		del_gendisk(d->gd);
		put_disk(d->gd);
		blk_cleanup_queue(d->blkq);
	}
	t = d->targets;
	e = t + d->ntargets;
	for (; t < e && *t; t++)
		freetgt(d, *t);
	if (d->bufpool)
		mempool_destroy(d->bufpool);
	skbpoolfree(d);
	minor_free(d->sysminor);

	spin_lock_irqsave(&d->lock, flags);
	d->flags |= DEVFL_FREED;
	spin_unlock_irqrestore(&d->lock, flags);
}