Commit c8e251fa authored by Cody P Schafer's avatar Cody P Schafer Committed by Linus Torvalds
Browse files

mm/page_alloc: prevent concurrent updaters of pcp ->batch and ->high

Because we are going to rely upon a careful transision between old and new
->high and ->batch values using memory barriers and will remove
stop_machine(), we need to prevent multiple updaters from interweaving
their memory writes.

Add a simple mutex to protect both update loops.
Signed-off-by: default avatarCody P Schafer <>
Cc: Gilad Ben-Yossef <>
Cc: KOSAKI Motohiro <>
Cc: Mel Gorman <>
Cc: Pekka Enberg <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 4008bab7
......@@ -65,6 +65,9 @@
#include <asm/div64.h>
#include "internal.h"
/* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */
static DEFINE_MUTEX(pcp_batch_high_lock);
DEFINE_PER_CPU(int, numa_node);
......@@ -5557,6 +5560,8 @@ int percpu_pagelist_fraction_sysctl_handler(ctl_table *table, int write,
ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
if (!write || (ret < 0))
return ret;
for_each_populated_zone(zone) {
for_each_possible_cpu(cpu) {
unsigned long high;
......@@ -5565,6 +5570,7 @@ int percpu_pagelist_fraction_sysctl_handler(ctl_table *table, int write,
per_cpu_ptr(zone->pageset, cpu), high);
return 0;
......@@ -6078,7 +6084,9 @@ static int __meminit __zone_pcp_update(void *data)
void __meminit zone_pcp_update(struct zone *zone)
stop_machine(__zone_pcp_update, zone, NULL);
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