* Zhouping Liu <zliu@xxxxxxxxxx> wrote: > Hi Johannes, > > Tested the below patch, and I'm sure it has fixed the above > issue, thank you. Thanks. Below is the folded up patch. Ingo ----------------------------> Subject: sched, numa, mm: Add memcg support to do_huge_pmd_numa_page() From: Johannes Weiner <hannes@xxxxxxxxxxx> Date: Thu Oct 25 12:49:51 CEST 2012 Add memory control group support to hugepage migration. Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx> Tested-by: Zhouping Liu <zliu@xxxxxxxxxx> Link: http://lkml.kernel.org/n/tip-rDk9mgpoyhZlwh2xhlykvgnp@xxxxxxxxxxxxxx Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx> --- mm/huge_memory.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) Index: tip/mm/huge_memory.c =================================================================== --- tip.orig/mm/huge_memory.c +++ tip/mm/huge_memory.c @@ -743,6 +743,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; @@ -833,6 +834,14 @@ migrate: return; } + /* + * Traditional migration needs to prepare the memcg charge + * transaction early to prevent the old page from being + * uncharged when installing migration entries. Here we can + * save the potential rollback and start the charge transfer + * only when migration is already known to end successfully. + */ + mem_cgroup_prepare_migration(page, new_page, &memcg); entry = mk_pmd(new_page, vma->vm_page_prot); entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); @@ -843,6 +852,12 @@ migrate: set_pmd_at(mm, haddr, pmd, entry); update_mmu_cache_pmd(vma, address, entry); page_remove_rmap(page); + /* + * Finish the charge transaction under the page table lock to + * prevent split_huge_page() from dividing up the charge + * before it's fully transferred to the new page. + */ + mem_cgroup_end_migration(memcg, page, new_page, true); spin_unlock(&mm->page_table_lock); put_page(page); /* Drop the rmap reference */ -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>