Relax allocations requirements
CAS does not need atomic alocations virtually anywhere. GFP_NOIO should be sufficient in IO path. When allocation buffers during module initialization use GFP_KERNEL. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
f9f00df576
commit
9b8fdde201
@ -55,7 +55,7 @@ void *_cas_alloc_page_rpool(void *allocator_ctx, int cpu)
|
||||
{
|
||||
struct page *page;
|
||||
|
||||
page = alloc_page(GFP_NOIO | __GFP_NORETRY);
|
||||
page = alloc_page(GFP_KERNEL);
|
||||
if (!page)
|
||||
return NULL;
|
||||
|
||||
|
@ -34,7 +34,7 @@ static inline size_t env_allocator_align(size_t size)
|
||||
}
|
||||
|
||||
struct _env_allocator_item {
|
||||
uint32_t flags;
|
||||
uint32_t from_rpool;
|
||||
uint32_t cpu;
|
||||
char data[];
|
||||
};
|
||||
@ -49,7 +49,7 @@ void *env_allocator_new(env_allocator *allocator)
|
||||
memset(item->data, 0, allocator->item_size -
|
||||
sizeof(struct _env_allocator_item));
|
||||
} else {
|
||||
item = kmem_cache_zalloc(allocator->kmem_cache, GFP_ATOMIC);
|
||||
item = kmem_cache_zalloc(allocator->kmem_cache, GFP_NOIO);
|
||||
}
|
||||
|
||||
if (item) {
|
||||
@ -66,11 +66,10 @@ void *env_allocator_new_rpool(void *allocator_ctx, int cpu)
|
||||
env_allocator *allocator = (env_allocator*) allocator_ctx;
|
||||
struct _env_allocator_item *item;
|
||||
|
||||
item = kmem_cache_zalloc(allocator->kmem_cache, GFP_NOIO |
|
||||
__GFP_NORETRY);
|
||||
item = kmem_cache_zalloc(allocator->kmem_cache, GFP_KERNEL);
|
||||
|
||||
if (item) {
|
||||
item->flags = (GFP_NOIO | __GFP_NORETRY);
|
||||
item->from_rpool = 1;
|
||||
item->cpu = cpu;
|
||||
}
|
||||
|
||||
@ -176,9 +175,10 @@ void env_allocator_del(env_allocator *allocator, void *obj)
|
||||
|
||||
atomic_dec(&allocator->count);
|
||||
|
||||
if (item->flags == (GFP_NOIO | __GFP_NORETRY) &&
|
||||
!cas_rpool_try_put(allocator->rpool, item, item->cpu))
|
||||
if (item->from_rpool && !cas_rpool_try_put(allocator->rpool, item,
|
||||
item->cpu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
kmem_cache_free(allocator->kmem_cache, item);
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#define ENV_MEM_NORMAL GFP_KERNEL
|
||||
#define ENV_MEM_NOIO GFP_NOIO
|
||||
#define ENV_MEM_ATOMIC GFP_ATOMIC
|
||||
|
||||
static inline uint64_t env_get_free_memory(void)
|
||||
{
|
||||
|
@ -721,7 +721,7 @@ static int cas_atomic_submit_discard_bio(struct cas_atomic_io *atom)
|
||||
int offset;
|
||||
unsigned long *cmd_addr = blk_mq_rq_to_pdu(req);
|
||||
|
||||
nvm_discard = kmalloc(sizeof(*nvm_discard), GFP_ATOMIC);
|
||||
nvm_discard = kmalloc(sizeof(*nvm_discard), GFP_NOIO);
|
||||
if (!nvm_discard) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ static int _blockdev_alloc_many_requests(ocf_core_t core,
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
data = cas_alloc_blk_data(bio_segments(bio), GFP_ATOMIC);
|
||||
data = cas_alloc_blk_data(bio_segments(bio), GFP_NOIO);
|
||||
if (!data) {
|
||||
CAS_PRINT_RL(KERN_CRIT "BIO data vector allocation error\n");
|
||||
error = -ENOMEM;
|
||||
@ -420,7 +420,7 @@ static int __block_dev_queue_rq(struct request *rq, ocf_core_t core)
|
||||
}
|
||||
|
||||
if (single_io) {
|
||||
data = cas_alloc_blk_data(size, GFP_ATOMIC);
|
||||
data = cas_alloc_blk_data(size, GFP_NOIO);
|
||||
if (data == NULL) {
|
||||
CAS_PRINT_RL(KERN_CRIT
|
||||
"Out of memory. Ending IO processing.\n");
|
||||
@ -445,7 +445,7 @@ static int __block_dev_queue_rq(struct request *rq, ocf_core_t core)
|
||||
} else {
|
||||
struct list_head list = LIST_HEAD_INIT(list);
|
||||
|
||||
data = cas_alloc_blk_data(0, GFP_ATOMIC);
|
||||
data = cas_alloc_blk_data(0, GFP_NOIO);
|
||||
if (data == NULL) {
|
||||
printk(KERN_CRIT
|
||||
"Out of memory. Ending IO processing.\n");
|
||||
@ -753,7 +753,7 @@ static int _blockdev_make_request_fast(struct casdsk_disk *dsk,
|
||||
return CASDSK_BIO_HANDLED;
|
||||
}
|
||||
|
||||
data = cas_alloc_blk_data(bio_segments(bio), GFP_ATOMIC);
|
||||
data = cas_alloc_blk_data(bio_segments(bio), GFP_NOIO);
|
||||
if (!data) {
|
||||
CAS_PRINT_RL(KERN_CRIT "BIO data vector allocation error\n");
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(-ENOMEM));
|
||||
|
@ -108,13 +108,13 @@ static inline void _casdsk_exp_obj_handle_bio_pt(struct casdsk_disk *dsk,
|
||||
struct bio *cloned_bio;
|
||||
struct casdsk_exp_obj_pt_io_ctx *io;
|
||||
|
||||
io = kmem_cache_zalloc(casdsk_module->pt_io_ctx_cache, GFP_ATOMIC);
|
||||
io = kmem_cache_zalloc(casdsk_module->pt_io_ctx_cache, GFP_NOIO);
|
||||
if (!io) {
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(-ENOMEM));
|
||||
return;
|
||||
}
|
||||
|
||||
cloned_bio = cas_bio_clone(bio, GFP_ATOMIC);
|
||||
cloned_bio = cas_bio_clone(bio, GFP_NOIO);
|
||||
if (!cloned_bio) {
|
||||
kmem_cache_free(casdsk_module->pt_io_ctx_cache, io);
|
||||
CAS_BIO_ENDIO(bio, CAS_BIO_BISIZE(bio), CAS_ERRNO_TO_BLK_STS(-ENOMEM));
|
||||
|
Loading…
Reference in New Issue
Block a user