We should not be seeing non-0 unevictable_pgs_mlockfreed any longer.
So remove free_page_mlock() from the page freeing paths: __PG_MLOCKED
is already in PAGE_FLAGS_CHECK_AT_FREE, so free_pages_check() will now
be checking it, reporting "BUG: Bad page state" if it's ever found set.
Comment UNEVICTABLE_MLOCKFREED and unevictable_pgs_mlockfreed always 0.

Signed-off-by: Hugh Dickins <hu...@google.com>
Cc: Mel Gorman <m...@csn.ul.ie>
Cc: Rik van Riel <r...@redhat.com>
Cc: Johannes Weiner <han...@cmpxchg.org>
Cc: Michel Lespinasse <wal...@google.com>
Cc: Ying Han <ying...@google.com>
---
 include/linux/vm_event_item.h |    2 +-
 mm/page_alloc.c               |   17 -----------------
 mm/vmstat.c                   |    2 +-
 3 files changed, 2 insertions(+), 19 deletions(-)

--- 3.6-rc6.orig/include/linux/vm_event_item.h  2012-09-18 15:38:08.000000000 
-0700
+++ 3.6-rc6/include/linux/vm_event_item.h       2012-09-18 20:04:42.516625261 
-0700
@@ -52,7 +52,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PS
                UNEVICTABLE_PGMUNLOCKED,
                UNEVICTABLE_PGCLEARED,  /* on COW, page truncate */
                UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */
-               UNEVICTABLE_MLOCKFREED,
+               UNEVICTABLE_MLOCKFREED, /* no longer useful: always zero */
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
                THP_FAULT_ALLOC,
                THP_FAULT_FALLBACK,
--- 3.6-rc6.orig/mm/page_alloc.c        2012-09-18 15:38:08.000000000 -0700
+++ 3.6-rc6/mm/page_alloc.c     2012-09-18 20:04:42.520625316 -0700
@@ -597,17 +597,6 @@ out:
        zone->free_area[order].nr_free++;
 }
 
-/*
- * free_page_mlock() -- clean up attempts to free and mlocked() page.
- * Page should not be on lru, so no need to fix that up.
- * free_pages_check() will verify...
- */
-static inline void free_page_mlock(struct page *page)
-{
-       __dec_zone_page_state(page, NR_MLOCK);
-       __count_vm_event(UNEVICTABLE_MLOCKFREED);
-}
-
 static inline int free_pages_check(struct page *page)
 {
        if (unlikely(page_mapcount(page) |
@@ -721,14 +710,11 @@ static bool free_pages_prepare(struct pa
 static void __free_pages_ok(struct page *page, unsigned int order)
 {
        unsigned long flags;
-       int wasMlocked = __TestClearPageMlocked(page);
 
        if (!free_pages_prepare(page, order))
                return;
 
        local_irq_save(flags);
-       if (unlikely(wasMlocked))
-               free_page_mlock(page);
        __count_vm_events(PGFREE, 1 << order);
        free_one_page(page_zone(page), page, order,
                                        get_pageblock_migratetype(page));
@@ -1296,7 +1282,6 @@ void free_hot_cold_page(struct page *pag
        struct per_cpu_pages *pcp;
        unsigned long flags;
        int migratetype;
-       int wasMlocked = __TestClearPageMlocked(page);
 
        if (!free_pages_prepare(page, 0))
                return;
@@ -1304,8 +1289,6 @@ void free_hot_cold_page(struct page *pag
        migratetype = get_pageblock_migratetype(page);
        set_page_private(page, migratetype);
        local_irq_save(flags);
-       if (unlikely(wasMlocked))
-               free_page_mlock(page);
        __count_vm_event(PGFREE);
 
        /*
--- 3.6-rc6.orig/mm/vmstat.c    2012-09-18 15:38:08.000000000 -0700
+++ 3.6-rc6/mm/vmstat.c 2012-09-18 20:04:42.524625352 -0700
@@ -781,7 +781,7 @@ const char * const vmstat_text[] = {
        "unevictable_pgs_munlocked",
        "unevictable_pgs_cleared",
        "unevictable_pgs_stranded",
-       "unevictable_pgs_mlockfreed",
+       "unevictable_pgs_mlockfreed",   /* no longer useful: always zero */
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
        "thp_fault_alloc",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to