public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Tejun Heo <tj@kernel.org>, lizefan@huawei.com
Cc: containers@lists.linux-foundation.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Michal Hocko <mhocko@suse.cz>,
	Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH 04/23] hugetlb_cgroup: pass around @hugetlb_cgroup instead of @cgroup
Date: Fri, 02 Aug 2013 10:05:40 +0530	[thread overview]
Message-ID: <87pptwwvz7.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <1375393801-4817-5-git-send-email-tj@kernel.org>

Tejun Heo <tj@kernel.org> writes:

> cgroup controller API will be converted to primarily use struct
> cgroup_subsys_state instead of struct cgroup.  In preparation, make
> hugetlb_cgroup functions pass around struct hugetlb_cgroup instead of
> struct cgroup.
>
> This patch shouldn't cause any behavior differences.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Johannes Weiner <hannes@cmpxchg.org>

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>


> ---
>  mm/hugetlb_cgroup.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
> index 50f213f..d2f9fc0 100644
> --- a/mm/hugetlb_cgroup.c
> +++ b/mm/hugetlb_cgroup.c
> @@ -56,17 +56,19 @@ static inline bool hugetlb_cgroup_is_root(struct hugetlb_cgroup *h_cg)
>  	return (h_cg == root_h_cgroup);
>  }
>
> -static inline struct hugetlb_cgroup *parent_hugetlb_cgroup(struct cgroup *cg)
> +static inline struct hugetlb_cgroup *
> +parent_hugetlb_cgroup(struct hugetlb_cgroup *h_cg)
>  {
> -	if (!cg->parent)
> +	struct cgroup *parent = h_cg->css.cgroup->parent;
> +
> +	if (!parent)
>  		return NULL;
> -	return hugetlb_cgroup_from_cgroup(cg->parent);
> +	return hugetlb_cgroup_from_cgroup(parent);
>  }
>
> -static inline bool hugetlb_cgroup_have_usage(struct cgroup *cg)
> +static inline bool hugetlb_cgroup_have_usage(struct hugetlb_cgroup *h_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)
> @@ -115,15 +117,14 @@ static void hugetlb_cgroup_css_free(struct cgroup *cgroup)
>   * page reference and test for page active here. This function
>   * cannot fail.
>   */
> -static void hugetlb_cgroup_move_parent(int idx, struct cgroup *cgroup,
> +static void hugetlb_cgroup_move_parent(int idx, struct hugetlb_cgroup *h_cg,
>  				       struct page *page)
>  {
>  	int csize;
>  	struct res_counter *counter;
>  	struct res_counter *fail_res;
>  	struct hugetlb_cgroup *page_hcg;
> -	struct hugetlb_cgroup *h_cg   = hugetlb_cgroup_from_cgroup(cgroup);
> -	struct hugetlb_cgroup *parent = parent_hugetlb_cgroup(cgroup);
> +	struct hugetlb_cgroup *parent = parent_hugetlb_cgroup(h_cg);
>
>  	page_hcg = hugetlb_cgroup_from_page(page);
>  	/*
> @@ -155,6 +156,7 @@ out:
>   */
>  static void hugetlb_cgroup_css_offline(struct cgroup *cgroup)
>  {
> +	struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_cgroup(cgroup);
>  	struct hstate *h;
>  	struct page *page;
>  	int idx = 0;
> @@ -163,13 +165,13 @@ static void hugetlb_cgroup_css_offline(struct cgroup *cgroup)
>  		for_each_hstate(h) {
>  			spin_lock(&hugetlb_lock);
>  			list_for_each_entry(page, &h->hugepage_activelist, lru)
> -				hugetlb_cgroup_move_parent(idx, cgroup, page);
> +				hugetlb_cgroup_move_parent(idx, h_cg, page);
>
>  			spin_unlock(&hugetlb_lock);
>  			idx++;
>  		}
>  		cond_resched();
> -	} while (hugetlb_cgroup_have_usage(cgroup));
> +	} while (hugetlb_cgroup_have_usage(h_cg));
>  }
>
>  int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
> -- 
> 1.8.3.1


  reply	other threads:[~2013-08-02  4:35 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 21:49 [PATCHSET cgroup/for-3.12] cgroup: use cgroup_subsys_state as the primary subsystem interface handle Tejun Heo
2013-08-01 21:49 ` [PATCH 01/23] cgroup: s/cgroup_subsys_state/cgroup_css/ s/task_subsys_state/task_css/ Tejun Heo
2013-08-01 21:49 ` [PATCH 02/23] cpuset: drop "const" qualifiers from struct cpuset instances Tejun Heo
2013-08-01 21:49 ` [PATCH 03/23] netprio_cgroup: pass around @css instead of @cgroup and kill struct cgroup_netprio_state Tejun Heo
2013-08-01 22:07   ` David Miller
2013-08-02 11:42   ` Neil Horman
2013-08-01 21:49 ` [PATCH 04/23] hugetlb_cgroup: pass around @hugetlb_cgroup instead of @cgroup Tejun Heo
2013-08-02  4:35   ` Aneesh Kumar K.V [this message]
2013-08-02 13:10   ` Michal Hocko
2013-08-01 21:49 ` [PATCH 05/23] cgroup: add subsystem pointer to cgroup_subsys_state Tejun Heo
2013-08-01 21:49 ` [PATCH 06/23] cgroup: add/update accessors which obtain subsys specific data from css Tejun Heo
2013-08-01 21:49 ` [PATCH 07/23] cgroup: add css_parent() Tejun Heo
2013-08-01 21:49 ` [PATCH 08/23] cgroup: pass around cgroup_subsys_state instead of cgroup in subsystem methods Tejun Heo
2013-08-02  3:54   ` Li Zefan
2013-08-02 19:36     ` Tejun Heo
2013-08-02  4:02   ` Li Zefan
2013-08-02 19:41     ` Tejun Heo
2013-08-02 13:19   ` Michal Hocko
2013-08-02 13:43     ` Michal Hocko
2013-08-02 19:52       ` Tejun Heo
2013-08-02 19:38     ` Tejun Heo
2013-08-02 20:24   ` [PATCH v2 " Tejun Heo
2013-08-06  7:19     ` Daniel Wagner
2013-08-05 12:44   ` [PATCH " Vivek Goyal
2013-08-05 17:57   ` Aristeu Rozanski
2013-08-01 21:49 ` [PATCH 09/23] cgroup: add subsys backlink pointer to cftype Tejun Heo
2013-08-05 12:49   ` Vivek Goyal
2013-08-01 21:49 ` [PATCH 10/23] cgroup: pin cgroup_subsys_state when opening a cgroupfs file Tejun Heo
2013-08-01 21:49 ` [PATCH 11/23] cgroup: add cgroup->dummy_css Tejun Heo
2013-08-01 21:49 ` [PATCH 12/23] cgroup: pass around cgroup_subsys_state instead of cgroup in file methods Tejun Heo
2013-08-02 13:27   ` Michal Hocko
2013-08-05 14:19   ` Vivek Goyal
2013-08-05 18:04   ` Aristeu Rozanski
2013-08-06  6:48   ` Daniel Wagner
2013-08-01 21:49 ` [PATCH 13/23] cgroup: convert cgroup_next_sibling() to cgroup_next_child() Tejun Heo
2013-08-01 21:49 ` [PATCH 14/23] cgroup: always use cgroup_next_child() to walk the children list Tejun Heo
2013-08-01 21:49 ` [PATCH 15/23] cgroup: make hierarchy iterators deal with cgroup_subsys_state instead of cgroup Tejun Heo
2013-08-02 13:32   ` Michal Hocko
2013-08-05 14:25   ` Vivek Goyal
2013-08-05 18:10   ` Aristeu Rozanski
2013-08-01 21:49 ` [PATCH 16/23] cgroup: relocate cgroup_advance_iter() Tejun Heo
2013-08-02  3:25   ` Li Zefan
2013-08-02 19:35     ` Tejun Heo
2013-08-01 21:49 ` [PATCH 17/23] cgroup: rename cgroup_iter to cgroup_task_iter Tejun Heo
2013-08-02 13:35   ` Michal Hocko
2013-08-01 21:49 ` [PATCH 18/23] cgroup: make cgroup_task_iter remember the cgroup being iterated Tejun Heo
2013-08-02 13:38   ` Michal Hocko
2013-08-01 21:49 ` [PATCH 19/23] cgroup: remove struct cgroup_scanner Tejun Heo
2013-08-01 21:49 ` [PATCH 20/23] cgroup: make task iterators deal with cgroup_subsys_state instead of cgroup Tejun Heo
2013-08-02 13:40   ` Michal Hocko
2013-08-01 21:49 ` [PATCH 21/23] cgroup: make cftype->[un]register_event() " Tejun Heo
2013-08-02  4:08   ` Li Zefan
2013-08-02 19:44     ` Tejun Heo
2013-08-02 13:42   ` Michal Hocko
2013-08-02 20:24   ` [PATCH v2 " Tejun Heo
2013-08-01 21:50 ` [PATCH 22/23] cgroup: make cgroup_taskset " Tejun Heo
2013-08-06  6:53   ` Daniel Wagner
2013-08-01 21:50 ` [PATCH 23/23] cgroup: unexport cgroup_css() Tejun Heo
2013-08-02  3:24 ` [PATCHSET cgroup/for-3.12] cgroup: use cgroup_subsys_state as the primary subsystem interface handle Li Zefan
2013-08-09  0:12 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pptwwvz7.fsf@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=cgroups@vger.kernel.org \
    --cc=containers@lists.linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mhocko@suse.cz \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox