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.
Unified · Split
| @@ -7988,6 +7988,15 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table, int write, · 7987 unmodified lines | |||
| 7988 | return 0; | 7988 | return 0; |
| 7989 | } | 7989 | } |
| 7990 | 7990 | ||
| 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 | |||
| 7991 | /* | 8000 | /* |
| 7992 | * percpu_pagelist_fraction - changes the pcp->high for each zone on each | 8001 | * percpu_pagelist_fraction - changes the pcp->high for each zone on each |
| 7993 | * cpu. It is the fraction of total pages in each zone that a hot per cpu | 8002 | * 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 | |||
| 8019 | if (percpu_pagelist_fraction == old_percpu_pagelist_fraction) | 8028 | if (percpu_pagelist_fraction == old_percpu_pagelist_fraction) |
| 8020 | goto out; | 8029 | goto out; |
| 8021 | 8030 | ||
| 8022 | for_each_populated_zone(zone) { | 8031 | for_each_populated_zone(zone) |
| 8023 | unsigned int cpu; | 8032 | __zone_pcp_update(zone); |
| 8024 | |||
| 8025 | for_each_possible_cpu(cpu) | ||
| 8026 | pageset_set_high_and_batch(zone, | ||
| 8027 | per_cpu_ptr(zone->pageset, cpu)); | ||
| 8028 | } | ||
| 8029 | out: | 8033 | out: |
| 8030 | mutex_unlock(&pcp_batch_high_lock); | 8034 | mutex_unlock(&pcp_batch_high_lock); |
| 8031 | return ret; | 8035 | return ret; |
| @@ -8624,11 +8628,8 @@ void free_contig_range(unsigned long pfn, unsigned int nr_pages) · 592 unmodified lines | |||
| 8624 | */ | 8628 | */ |
| 8625 | void __meminit zone_pcp_update(struct zone *zone) | 8629 | void __meminit zone_pcp_update(struct zone *zone) |
| 8626 | { | 8630 | { |
| 8627 | unsigned cpu; | ||
| 8628 | mutex_lock(&pcp_batch_high_lock); | 8631 | mutex_lock(&pcp_batch_high_lock); |
| 8629 | for_each_possible_cpu(cpu) | 8632 | __zone_pcp_update(zone); |
| 8630 | pageset_set_high_and_batch(zone, | ||
| 8631 | per_cpu_ptr(zone->pageset, cpu)); | ||
| 8632 | mutex_unlock(&pcp_batch_high_lock); | 8633 | mutex_unlock(&pcp_batch_high_lock); |
| 8633 | } | 8634 | } |
| 8634 | 8635 | ||