History

mm, pcp: share common code between memory hotplug and percpu sysctl handler

Both the percpu_pagelist_fraction sysctl handler and memory hotplug have a common requirement of updating the pcpu page allocation batch and high values. Split the relevant helper to share common code. No functional change.

Mel Gorman committed 6 years ago

Commit cb1ef531 parent 5e27a2d1 file · +12 −11Browse files

Unified · Split

mm/page_alloc.c+12−11
@@ -7988,6 +7988,15 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table, int write, · 7987 unmodified lines
79887988 return 0;
79897989 }
79907990
7991+static void __zone_pcp_update(struct zone *zone)
7992+{
7993+ unsigned int cpu;
7994+
7995+ for_each_possible_cpu(cpu)
7996+ pageset_set_high_and_batch(zone,
7997+ per_cpu_ptr(zone->pageset, cpu));
7998+}
7999+
79918000 /*
79928001 * percpu_pagelist_fraction - changes the pcp->high for each zone on each
79938002 * cpu. It is the fraction of total pages in each zone that a hot per cpu
@@ -8019,13 +8028,8 @@ int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *table, int write, · 25 unmodified lines
80198028 if (percpu_pagelist_fraction == old_percpu_pagelist_fraction)
80208029 goto out;
80218030
8022− for_each_populated_zone(zone) {
8023− unsigned int cpu;
8024−
8025− for_each_possible_cpu(cpu)
8026− pageset_set_high_and_batch(zone,
8027− per_cpu_ptr(zone->pageset, cpu));
8028− }
8031+ for_each_populated_zone(zone)
8032+ __zone_pcp_update(zone);
80298033 out:
80308034 mutex_unlock(&pcp_batch_high_lock);
80318035 return ret;
@@ -8624,11 +8628,8 @@ void free_contig_range(unsigned long pfn, unsigned int nr_pages) · 592 unmodified lines
86248628 */
86258629 void __meminit zone_pcp_update(struct zone *zone)
86268630 {
8627− unsigned cpu;
86288631 mutex_lock(&pcp_batch_high_lock);
8629− for_each_possible_cpu(cpu)
8630− pageset_set_high_and_batch(zone,
8631− per_cpu_ptr(zone->pageset, cpu));
8632+ __zone_pcp_update(zone);
86328633 mutex_unlock(&pcp_batch_high_lock);
86338634 }
86348635

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t