]> 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, 27 Jun 2013 23:51:22 +0000 (09:51 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 28 Jun 2013 06:37:27 +0000 (16:37 +1000)
commitc9dbe064808260cc170a73049cbdaf2484b9cfe0
tree7361f2e2e3a30fe9888e54db94adce77f5ed38d5
parent67f9fa9ba4d72f1b5c8086a8b8b99fac9a45cc57
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