]> 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>
Thu, 23 May 2013 00:37:12 +0000 (10:37 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 27 May 2013 06:09:01 +0000 (16:09 +1000)
commit9bbd9aab571f3e411fda36fdd5d13301a0afdab5
tree50deb3bbf8f30e2912d6a6eb66c17e1c0b33ae64
parent8d7176a9ba94421ce65c6ba250f3bf8d0601abe4
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