Commit 0e8c7d0fd5b4999675c7d5cd95d0eb7106b756b3
Committed by
Linus Torvalds
1 parent
10ccaf4b71
Exists in
master
and in
7 other branches
page migration: fix NR_FILE_PAGES accounting
NR_FILE_PAGES must be accounted for depending on the zone that the page belongs to. If we replace the page in the radix tree then we may have to shift the count to another zone. Suggested-by: Ethan Solomita <solo@google.com> Eventually-typed-in-by: Christoph Lameter <clameter@sgi.com> Cc: Martin Bligh <mbligh@mbligh.org> Cc: <stable@kernel.org> Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 14 additions and 1 deletions Side-by-side Diff
mm/migrate.c
... | ... | @@ -297,7 +297,7 @@ |
297 | 297 | void **pslot; |
298 | 298 | |
299 | 299 | if (!mapping) { |
300 | - /* Anonymous page */ | |
300 | + /* Anonymous page without mapping */ | |
301 | 301 | if (page_count(page) != 1) |
302 | 302 | return -EAGAIN; |
303 | 303 | return 0; |
... | ... | @@ -332,6 +332,19 @@ |
332 | 332 | * We know this isn't the last reference. |
333 | 333 | */ |
334 | 334 | __put_page(page); |
335 | + | |
336 | + /* | |
337 | + * If moved to a different zone then also account | |
338 | + * the page for that zone. Other VM counters will be | |
339 | + * taken care of when we establish references to the | |
340 | + * new page and drop references to the old page. | |
341 | + * | |
342 | + * Note that anonymous pages are accounted for | |
343 | + * via NR_FILE_PAGES and NR_ANON_PAGES if they | |
344 | + * are mapped to swap space. | |
345 | + */ | |
346 | + __dec_zone_page_state(page, NR_FILE_PAGES); | |
347 | + __inc_zone_page_state(newpage, NR_FILE_PAGES); | |
335 | 348 | |
336 | 349 | write_unlock_irq(&mapping->tree_lock); |
337 | 350 |