]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mm/page_alloc: insert memory barriers to allow async update of pcp batch and high
authorCody P Schafer <cody@linux.vnet.ibm.com>
Fri, 7 Jun 2013 00:07:35 +0000 (10:07 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 7 Jun 2013 05:42:04 +0000 (15:42 +1000)
commit3e1a33cf25ab206c144f5da1c2bf6c5a1ffa9e7a
tree962979d4d49eb6ec2432b0730e5756f6d1aee5d4
parent6b6918a124ecc15dec04e749ddec422f6399617e
mm/page_alloc: insert memory barriers to allow async update of pcp batch and high

Introduce pageset_update() to perform a safe transision from one set of
pcp->{batch,high} to a new set using memory barriers.

This ensures that batch is always set to a safe value (1) prior to
updating high, and ensure that high is fully updated before setting the
real value of batch.  It avoids ->batch ever rising above ->high.

Suggested by Gilad Ben-Yossef in these threads:

https://lkml.org/lkml/2013/4/9/23
https://lkml.org/lkml/2013/4/10/49

Also reproduces his proposed comment.

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Reviewed-by: Gilad Ben-Yossef <gilad@benyossef.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_alloc.c