+ memcg-redefine-callback-functions-for-page-table-walker.patch added to -mm tree
Subsystems (2)
[email protected]
maintainerSubject: + memcg-redefine-callback-functions-for-page-table-walker.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Mon, 10 Feb 2014 14:42:20 -0800
The patch titled
Subject: memcg: redefine callback functions for page table walker
has been added to the -mm tree. Its filename is
memcg-redefine-callback-functions-for-page-table-walker.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/memcg-redefine-callback-functions-for-page-table-walker.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/memcg-redefine-callback-functions-for-page-table-walker.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Naoya Horiguchi <[email protected]>
Subject: memcg: redefine callback functions for page table walker
Move code around pte loop in mem_cgroup_count_precharge_pte_range() into mem_cgroup_count_precharge_pte() connected to pte_entry().
We don't change the callback mem_cgroup_move_charge_pte_range() for now, because we can't do the same replacement easily due to 'goto retry'.
---
mm/memcontrol.c | 71 +++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 44 deletions(-)
mm/memcontrol.c renamed from mm/memcontrol.c~memcg-redefine-callback-functions-for-page-table-walker +27 -44
@@ -6900,30 +6900,29 @@ static inline enum mc_target_type get_mc }#endif -static int mem_cgroup_count_precharge_pte_range (pmd_t *pmd, +static int mem_cgroup_count_precharge_pte (pte_t *pte,unsigned long addr,unsigned long end,struct mm_walk *walk) { -struct vm_area_struct *vma = walk->private; -pte_t *pte; +if (get_mctgt_type (walk->vma, addr, *pte,NULL )) + mc.precharge++;/* increment precharge temporarily */ +return 0 ; +} + +static int mem_cgroup_count_precharge_pmd (pmd_t *pmd, +unsigned long addr,unsigned long end, +struct mm_walk *walk) +{ +struct vm_area_struct *vma = walk->vma;spinlock_t *ptl;if (pmd_trans_huge_lock (pmd, vma, &ptl) ==1 ) {if (get_mctgt_type_thp (vma, addr, *pmd,NULL ) ==MC_TARGET_PAGE ) mc.precharge +=HPAGE_PMD_NR ;spin_unlock (ptl); -return 0 ; +/* don't call mem_cgroup_count_precharge_pte() */ + walk->skip =1 ; } - -if (pmd_trans_unstable (pmd)) -return 0 ; - pte =pte_offset_map_lock (vma->vm_mm, pmd, addr, &ptl); -for (; addr != end; pte++, addr +=PAGE_SIZE ) -if (get_mctgt_type (vma, addr, *pte,NULL )) - mc.precharge++;/* increment precharge temporarily */ -pte_unmap_unlock (pte -1 , ptl); -cond_resched (); -return 0 ; }
@@ -6932,18 +6931,14 @@ static unsigned long mem_cgroup_count_prunsigned long precharge;struct vm_area_struct *vma; +struct mm_walk mem_cgroup_count_precharge_walk = { + .pmd_entry = mem_cgroup_count_precharge_pmd, + .pte_entry = mem_cgroup_count_precharge_pte, + .mm = mm, + };down_read (&mm->mmap_sem); -for (vma = mm->mmap; vma; vma = vma->vm_next) { -struct mm_walk mem_cgroup_count_precharge_walk = { - .pmd_entry = mem_cgroup_count_precharge_pte_range, - .mm = mm, - .private = vma, - }; -if (is_vm_hugetlb_page (vma)) -continue ; -walk_page_range (vma->vm_start, vma->vm_end, - &mem_cgroup_count_precharge_walk); - } +for (vma = mm->mmap; vma; vma = vma->vm_next) +walk_page_vma (vma, &mem_cgroup_count_precharge_walk);up_read (&mm->mmap_sem); precharge = mc.precharge;
@@ -7082,7 +7077,7 @@ static int mem_cgroup_move_charge_pte_ra struct mm_walk *walk) {int ret =0 ; -struct vm_area_struct *vma = walk->private; +struct vm_area_struct *vma = walk->vma;pte_t *pte;spinlock_t *ptl;enum mc_target_type target_type;
@@ -7183,6 +7178,10 @@ put: /* get_mctgt_type() gets the pagestatic void mem_cgroup_move_charge (struct mm_struct *mm) {struct vm_area_struct *vma; +struct mm_walk mem_cgroup_move_charge_walk = { + .pmd_entry = mem_cgroup_move_charge_pte_range, + .mm = mm, + };lru_add_drain_all (); retry:
@@ -7198,24 +7197,8 @@ retry:cond_resched (); goto retry; } -for (vma = mm->mmap; vma; vma = vma->vm_next) { -int ret; -struct mm_walk mem_cgroup_move_charge_walk = { - .pmd_entry = mem_cgroup_move_charge_pte_range, - .mm = mm, - .private = vma, - }; -if (is_vm_hugetlb_page (vma)) -continue ; - ret =walk_page_range (vma->vm_start, vma->vm_end, - &mem_cgroup_move_charge_walk); -if (ret) -/* -* means we have consumed all precharges and failed in -* doing additional charge. Just abandon here. -*/ -break ; - } +for (vma = mm->mmap; vma; vma = vma->vm_next) +walk_page_vma (vma, &mem_cgroup_move_charge_walk);up_read (&mm->mmap_sem); }
_
Patches currently in -mm which might be from [email protected] are
mm-memory-failurec-move-refcount-only-in-mf_count_increased.patch mm-hugetlb-unify-region-structure-handling.patch mm-hugetlb-improve-cleanup-resv_map-parameters.patch mm-hugetlb-fix-race-in-region-tracking.patch mm-hugetlb-remove-resv_map_put.patch mm-hugetlb-use-vma_resv_map-map-types.patch mm-hugetlb-improve-page-fault-scalability.patch mm-hugetlb-improve-page-fault-scalability-fix.patch pagewalk-update-page-table-walker-core.patch pagewalk-add-walk_page_vma.patch smaps-redefine-callback-functions-for-page-table-walker.patch clear_refs-redefine-callback-functions-for-page-table-walker.patch pagemap-redefine-callback-functions-for-page-table-walker.patch numa_maps-redefine-callback-functions-for-page-table-walker.patch memcg-redefine-callback-functions-for-page-table-walker.patch madvise-redefine-callback-functions-for-page-table-walker.patch arch-powerpc-mm-subpage-protc-use-walk_page_vma-instead-of-walk_page_range.patch pagewalk-remove-argument-hmask-from-hugetlb_entry.patch mempolicy-apply-page-table-walker-on-queue_pages_range.patch