From: Johannes Weiner <han...@cmpxchg.org>

[ Turned email suggestions into patch plus fixes. ]
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
 mm/huge_memory.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Index: tip/mm/huge_memory.c
===================================================================
--- tip.orig/mm/huge_memory.c
+++ tip/mm/huge_memory.c
@@ -742,6 +742,7 @@ void do_huge_pmd_numa_page(struct mm_str
                           unsigned int flags, pmd_t entry)
 {
        unsigned long haddr = address & HPAGE_PMD_MASK;
+       struct mem_cgroup *memcg = NULL;
        struct page *new_page = NULL;
        struct page *page = NULL;
        int node, lru;
@@ -800,6 +801,8 @@ migrate:
        if (!new_page)
                goto alloc_fail;
 
+       mem_cgroup_prepare_migration(page, new_page, &memcg);
+
        lru = PageLRU(page);
 
        if (lru && isolate_lru_page(page)) /* does an implicit get_page() */
@@ -852,14 +855,19 @@ migrate:
                put_page(page);         /* drop the LRU isolation reference */
 
        unlock_page(new_page);
+
+       mem_cgroup_end_migration(memcg, page, new_page, true);
+
        unlock_page(page);
        put_page(page);                 /* Drop the local reference */
 
        return;
 
 alloc_fail:
-       if (new_page)
+       if (new_page) {
+               mem_cgroup_end_migration(memcg, page, new_page, false);
                put_page(new_page);
+       }
 
        unlock_page(page);
 


--
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