Commit 3e24aa58 authored by Tejun Heo's avatar Tejun Heo

percpu: add an indirection ptr for chunk page map access

Impact: allow sharing page map, no functional difference yet

Make chunk->page access indirect by adding a pointer and renaming the
actual array to page_ar.  This will be used by future changes.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 9a4f8a87
...@@ -80,7 +80,8 @@ struct pcpu_chunk { ...@@ -80,7 +80,8 @@ struct pcpu_chunk {
int map_alloc; /* # of map entries allocated */ int map_alloc; /* # of map entries allocated */
int *map; /* allocation map */ int *map; /* allocation map */
bool immutable; /* no [de]population allowed */ bool immutable; /* no [de]population allowed */
struct page *page[]; /* #cpus * UNIT_PAGES */ struct page **page; /* points to page array */
struct page *page_ar[]; /* #cpus * UNIT_PAGES */
}; };
static int pcpu_unit_pages __read_mostly; static int pcpu_unit_pages __read_mostly;
...@@ -696,6 +697,7 @@ static struct pcpu_chunk *alloc_pcpu_chunk(void) ...@@ -696,6 +697,7 @@ static struct pcpu_chunk *alloc_pcpu_chunk(void)
PCPU_DFL_MAP_ALLOC * sizeof(chunk->map[0])); PCPU_DFL_MAP_ALLOC * sizeof(chunk->map[0]));
chunk->map_alloc = PCPU_DFL_MAP_ALLOC; chunk->map_alloc = PCPU_DFL_MAP_ALLOC;
chunk->map[chunk->map_used++] = pcpu_unit_size; chunk->map[chunk->map_used++] = pcpu_unit_size;
chunk->page = chunk->page_ar;
chunk->vm = get_vm_area(pcpu_chunk_size, GFP_KERNEL); chunk->vm = get_vm_area(pcpu_chunk_size, GFP_KERNEL);
if (!chunk->vm) { if (!chunk->vm) {
...@@ -918,6 +920,7 @@ size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn, ...@@ -918,6 +920,7 @@ size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn,
schunk->vm = &first_vm; schunk->vm = &first_vm;
schunk->map = smap; schunk->map = smap;
schunk->map_alloc = ARRAY_SIZE(smap); schunk->map_alloc = ARRAY_SIZE(smap);
schunk->page = schunk->page_ar;
schunk->free_size = dyn_size; schunk->free_size = dyn_size;
schunk->contig_hint = schunk->free_size; schunk->contig_hint = schunk->free_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment