Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0e8c7d0fd5b4999675c7d5cd95d0eb7106b756b3
Commit:     0e8c7d0fd5b4999675c7d5cd95d0eb7106b756b3
Parent:     10ccaf4b7121fb839442be7e079baa8fd0b28caf
Author:     Christoph Lameter <[EMAIL PROTECTED]>
AuthorDate: Mon Apr 23 14:41:09 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Apr 24 08:23:08 2007 -0700

    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 <[EMAIL PROTECTED]>
    Eventually-typed-in-by: Christoph Lameter <[EMAIL PROTECTED]>
    Cc: Martin Bligh <[EMAIL PROTECTED]>
    Cc: <[EMAIL PROTECTED]>
    Signed-off-by: Christoph Lameter <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/migrate.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 7a66ca2..a91ca00 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -297,7 +297,7 @@ static int migrate_page_move_mapping(struct address_space 
*mapping,
        void **pslot;
 
        if (!mapping) {
-               /* Anonymous page */
+               /* Anonymous page without mapping */
                if (page_count(page) != 1)
                        return -EAGAIN;
                return 0;
@@ -333,6 +333,19 @@ static int migrate_page_move_mapping(struct address_space 
*mapping,
         */
        __put_page(page);
 
+       /*
+        * If moved to a different zone then also account
+        * the page for that zone. Other VM counters will be
+        * taken care of when we establish references to the
+        * new page and drop references to the old page.
+        *
+        * Note that anonymous pages are accounted for
+        * via NR_FILE_PAGES and NR_ANON_PAGES if they
+        * are mapped to swap space.
+        */
+       __dec_zone_page_state(page, NR_FILE_PAGES);
+       __inc_zone_page_state(newpage, NR_FILE_PAGES);
+
        write_unlock_irq(&mapping->tree_lock);
 
        return 0;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to