From: Anna-Maria Gleixner <anna-maria@xxxxxxxxxxxxx> Splitting the functionality of drain_local_pages() into a separate function. This is a preparatory work for introducing the static key dependend locking mechanism. No functional change. Signed-off-by: Anna-Maria Gleixner <anna-maria@xxxxxxxxxxxxx> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> --- include/linux/gfp.h | 1 + mm/page_alloc.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index fdab7de7490df..fcad3a07c9b04 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -557,6 +557,7 @@ extern void page_frag_free(void *addr); void page_alloc_init(void); void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp); void drain_all_pages(struct zone *zone); +void drain_cpu_pages(unsigned int cpu, struct zone *zone); void drain_local_pages(struct zone *zone); void page_alloc_init_late(void); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c6ce20aaf80bb..cf120e0700035 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2713,6 +2713,14 @@ static void drain_pages(unsigned int cpu) } } +void drain_cpu_pages(unsigned int cpu, struct zone *zone) +{ + if (zone) + drain_pages_zone(cpu, zone); + else + drain_pages(cpu); +} + /* * Spill all of this CPU's per-cpu pages back into the buddy allocator. * @@ -2723,10 +2731,7 @@ void drain_local_pages(struct zone *zone) { int cpu = smp_processor_id(); - if (zone) - drain_pages_zone(cpu, zone); - else - drain_pages(cpu); + drain_cpu_pages(cpu, zone); } static void drain_local_pages_wq(struct work_struct *work) -- 2.20.1