Skip to content

Commit

Permalink
slab: use 2M page for global_meta_slab
Browse files Browse the repository at this point in the history
This permits to allocate more slabs, due to the static nature
of global_meta_slab.

This is a workaround, until global_meta_slab allocation is made
fully dynamic.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Aug 12, 2021
1 parent 49aec5d commit 0a73acb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,20 @@ int init_slab(void) {
memset(&meta_slab_list, 0, sizeof(meta_slab_list));
memset(&global_meta_slab, 0, sizeof(global_meta_slab));

alloc_pages = get_free_pages(PAGE_ORDER_4K, GFP_KERNEL);
alloc_pages = get_free_pages(PAGE_ORDER_2M, GFP_KERNEL);
if (NULL == alloc_pages) {
dprintk("get_free_pages failed\n");
return -ENOMEM;
}
memset(alloc_pages, 0, PAGE_SIZE);
memset(alloc_pages, 0, PAGE_SIZE_2M);

global_meta_slab.slab_base = alloc_pages;
global_meta_slab.slab_len = PAGE_SIZE;
global_meta_slab.slab_len = PAGE_SIZE_2M;
global_meta_slab.slab_size = next_power_of_two(sizeof(meta_slab_t));
ret = initialize_slab(&global_meta_slab);
if (ret != ESUCCESS) {
dprintk("initialize_slab failed\n");
put_pages(alloc_pages, PAGE_ORDER_4K);
put_pages(alloc_pages, PAGE_ORDER_2M);
return ret;
}

Expand Down

0 comments on commit 0a73acb

Please sign in to comment.