All of lore.kernel.org
 help / color / mirror / Atom feed
* + hugetlb-cgroup-simplify-pre_destroy-callback.patch added to -mm tree
@ 2012-07-18 21:26 akpm
       [not found] ` <20120718212637.133475C0050-gd0R4GGuC+lfGOtoag0VdhPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
  0 siblings, 1 reply; 40+ messages in thread
From: akpm @ 2012-07-18 21:26 UTC (permalink / raw)
  To: mm-commits; +Cc: aneesh.kumar, kamezawa.hiroyu, liwanp, mhocko


The patch titled
     Subject: hugetlb/cgroup: simplify pre_destroy callback
has been added to the -mm tree.  Its filename is
     hugetlb-cgroup-simplify-pre_destroy-callback.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: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: hugetlb/cgroup: simplify pre_destroy callback

Since we cannot fail in hugetlb_cgroup_move_parent(), we don't really need
to check whether cgroup have any change left after that.  Also skip those
hstates for which we don't have any charge in this cgroup.

Based on an earlier patch from Wanpeng Li.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/hugetlb_cgroup.c |   49 ++++++++++++++++++------------------------
 1 file changed, 21 insertions(+), 28 deletions(-)

diff -puN mm/hugetlb_cgroup.c~hugetlb-cgroup-simplify-pre_destroy-callback mm/hugetlb_cgroup.c
--- a/mm/hugetlb_cgroup.c~hugetlb-cgroup-simplify-pre_destroy-callback
+++ a/mm/hugetlb_cgroup.c
@@ -65,18 +65,6 @@ static inline struct hugetlb_cgroup *par
 	return hugetlb_cgroup_from_cgroup(cg->parent);
 }
 
-static inline bool hugetlb_cgroup_have_usage(struct cgroup *cg)
-{
-	int idx;
-	struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_cgroup(cg);
-
-	for (idx = 0; idx < hugetlb_max_hstate; idx++) {
-		if ((res_counter_read_u64(&h_cg->hugepage[idx], RES_USAGE)) > 0)
-			return true;
-	}
-	return false;
-}
-
 static struct cgroup_subsys_state *hugetlb_cgroup_create(struct cgroup *cgroup)
 {
 	int idx;
@@ -159,24 +147,29 @@ static int hugetlb_cgroup_pre_destroy(st
 {
 	struct hstate *h;
 	struct page *page;
-	int ret = 0, idx = 0;
+	int ret = 0, idx;
+	struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_cgroup(cgroup);
 
-	do {
-		if (cgroup_task_count(cgroup) ||
-		    !list_empty(&cgroup->children)) {
-			ret = -EBUSY;
-			goto out;
-		}
-		for_each_hstate(h) {
-			spin_lock(&hugetlb_lock);
-			list_for_each_entry(page, &h->hugepage_activelist, lru)
-				hugetlb_cgroup_move_parent(idx, cgroup, page);
 
-			spin_unlock(&hugetlb_lock);
-			idx++;
-		}
-		cond_resched();
-	} while (hugetlb_cgroup_have_usage(cgroup));
+	if (cgroup_task_count(cgroup) ||
+	    !list_empty(&cgroup->children)) {
+		ret = -EBUSY;
+		goto out;
+	}
+
+	for_each_hstate(h) {
+		/*
+		 * if we don't have any charge, skip this hstate
+		 */
+		idx = hstate_index(h);
+		if (res_counter_read_u64(&h_cg->hugepage[idx], RES_USAGE) == 0)
+			continue;
+		spin_lock(&hugetlb_lock);
+		list_for_each_entry(page, &h->hugepage_activelist, lru)
+			hugetlb_cgroup_move_parent(idx, cgroup, page);
+		spin_unlock(&hugetlb_lock);
+		VM_BUG_ON(res_counter_read_u64(&h_cg->hugepage[idx], RES_USAGE));
+	}
 out:
 	return ret;
 }
_
Subject: Subject: hugetlb/cgroup: simplify pre_destroy callback

Patches currently in -mm which might be from aneesh.kumar@linux.vnet.ibm.com are

linux-next.patch
hugetlb-rename-max_hstate-to-hugetlb_max_hstate.patch
hugetlb-dont-use-err_ptr-with-vm_fault-values.patch
hugetlb-add-an-inline-helper-for-finding-hstate-index.patch
hugetlb-use-mmu_gather-instead-of-a-temporary-linked-list-for-accumulating-pages.patch
hugetlb-avoid-taking-i_mmap_mutex-in-unmap_single_vma-for-hugetlb.patch
hugetlb-simplify-migrate_huge_page.patch
hugetlb-add-a-list-for-tracking-in-use-hugetlb-pages.patch
hugetlb-make-some-static-variables-global.patch
hugetlb-make-some-static-variables-global-mark-hugelb_max_hstate-__read_mostly.patch
mm-hugetlb-add-new-hugetlb-cgroup.patch
mm-hugetlb-add-new-hugetlb-cgroup-fix.patch
mm-hugetlb-add-new-hugetlb-cgroup-fix-fix.patch
mm-hugetlb-add-new-hugetlb-cgroup-fix-3.patch
mm-hugetlb-add-new-hugetlb-cgroup-mark-root_h_cgroup-static.patch
hugetlb-cgroup-add-the-cgroup-pointer-to-page-lru.patch
hugetlb-cgroup-add-charge-uncharge-routines-for-hugetlb-cgroup.patch
hugetlb-cgroup-add-charge-uncharge-routines-for-hugetlb-cgroup-fix.patch
hugetlb-cgroup-add-charge-uncharge-routines-for-hugetlb-cgroup-add-huge_page_order-check-to-avoid-incorrectly-uncharge.patch
hugetlb-cgroup-add-support-for-cgroup-removal.patch
hugetlb-cgroup-add-hugetlb-cgroup-control-files.patch
hugetlb-cgroup-add-hugetlb-cgroup-control-files-fix.patch
hugetlb-cgroup-add-hugetlb-cgroup-control-files-fix-fix.patch
hugetlb-cgroup-migrate-hugetlb-cgroup-info-from-oldpage-to-new-page-during-migration.patch
hugetlb-cgroup-add-hugetlb-controller-documentation.patch
hugetlb-move-all-the-in-use-pages-to-active-list.patch
hugetlb-cgroup-assign-the-page-hugetlb-cgroup-when-we-move-the-page-to-active-list.patch
hugetlb-cgroup-remove-exclude-and-wakeup-rmdir-calls-from-migrate.patch
hugetlb-cgroup-simplify-pre_destroy-callback.patch
memcg-rename-config-variables.patch
memcg-rename-config-variables-fix.patch
memcg-rename-config-variables-fix-fix.patch


^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2012-07-30 18:25 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-18 21:26 + hugetlb-cgroup-simplify-pre_destroy-callback.patch added to -mm tree akpm
     [not found] ` <20120718212637.133475C0050-gd0R4GGuC+lfGOtoag0VdhPsWskHk0ljAL8bYrjMMd8@public.gmane.org>
2012-07-19 11:39   ` Michal Hocko
2012-07-19 11:39     ` Michal Hocko
2012-07-19 12:21     ` Aneesh Kumar K.V
     [not found]       ` <87r4s8gcwe.fsf-6yE53ggjAfyqSkle7U1LjlaTQe2KTcn/@public.gmane.org>
2012-07-19 12:38         ` Michal Hocko
2012-07-19 12:38           ` Michal Hocko
     [not found]           ` <20120719123820.GG2864-VqjxzfR4DlwKmadIfiO5sKVXKuFTiq87@public.gmane.org>
2012-07-19 13:48             ` Aneesh Kumar K.V
2012-07-19 13:48               ` Aneesh Kumar K.V
     [not found]               ` <87ipdjc15j.fsf-6yE53ggjAfyqSkle7U1LjlaTQe2KTcn/@public.gmane.org>
2012-07-19 14:09                 ` [PATCH] cgroup: Don't drop the cgroup_mutex in cgroup_rmdir Aneesh Kumar K.V
2012-07-19 14:09                   ` Aneesh Kumar K.V
     [not found]                   ` <1342706972-10912-1-git-send-email-aneesh.kumar-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2012-07-19 16:50                     ` Tejun Heo
2012-07-19 16:50                       ` Tejun Heo
2012-07-20 15:45                       ` Peter Zijlstra
2012-07-20 20:05                         ` Tejun Heo
2012-07-20 20:05                           ` Tejun Heo
2012-07-20 22:07                           ` Glauber Costa
     [not found]                           ` <20120720200542.GD21218-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-07-27  6:15                             ` Li Zefan
2012-07-27  6:15                               ` Li Zefan
     [not found]                               ` <501231F0.8050505-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2012-07-30 18:25                                 ` Tejun Heo
2012-07-30 18:25                                   ` Tejun Heo
2012-07-20  7:51                     ` Michal Hocko
2012-07-20  7:51                       ` Michal Hocko
2012-07-20 19:49                     ` Tejun Heo
2012-07-20 19:49                       ` Tejun Heo
2012-07-20  1:05                 ` + hugetlb-cgroup-simplify-pre_destroy-callback.patch added to -mm tree Kamezawa Hiroyuki
2012-07-20  1:05                   ` Kamezawa Hiroyuki
     [not found]                   ` <5008AEC2.9090707-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-07-20  1:20                     ` Kamezawa Hiroyuki
2012-07-20  1:20                       ` Kamezawa Hiroyuki
     [not found]                       ` <5008B25D.5000902-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-07-20  8:01                         ` Michal Hocko
2012-07-20  8:01                           ` Michal Hocko
2012-07-20  8:08                           ` Kamezawa Hiroyuki
2012-07-20  8:06               ` Michal Hocko
2012-07-20 19:18                 ` Aneesh Kumar K.V
2012-07-20 19:56                   ` Tejun Heo
     [not found]                     ` <20120720195643.GC21218-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2012-07-21  2:14                       ` Kamezawa Hiroyuki
2012-07-21  2:14                         ` Kamezawa Hiroyuki
2012-07-21  2:46                         ` Tejun Heo
2012-07-21  4:05                           ` Kamezawa Hiroyuki
     [not found]                             ` <500A2A79.5030705-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2012-07-22 17:34                               ` Tejun Heo
2012-07-22 17:34                                 ` Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.