linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: linux-mm@kvack.org, kamezawa.hiroyu@jp.fujitsu.com,
	akpm@linux-foundation.org
Subject: Re: [PATCH] hugetlb/cgroup: Remove unnecessary NULL checks
Date: Mon, 25 Jun 2012 14:14:48 +0200	[thread overview]
Message-ID: <20120625121448.GL19805@tiehlicka.suse.cz> (raw)
In-Reply-To: <1340556313-12789-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

On Sun 24-06-12 22:15:13, Aneesh Kumar K.V wrote:
> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
> 
> cgroup_subsys_state can never be NULL, so don't check
> for that in hugetlb_cgroup_from_css. Also current task will
> always be part of some cgroup. So hugetlb_cgrop_from_task
> cannot return NULL.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Reviewed-by: Michal Hocko <mhocko@suse.cz>

> ---
>  mm/hugetlb_cgroup.c |    7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
> index db40669..b834e8d 100644
> --- a/mm/hugetlb_cgroup.c
> +++ b/mm/hugetlb_cgroup.c
> @@ -36,9 +36,7 @@ static struct hugetlb_cgroup *root_h_cgroup __read_mostly;
>  static inline
>  struct hugetlb_cgroup *hugetlb_cgroup_from_css(struct cgroup_subsys_state *s)
>  {
> -	if (s)
> -		return container_of(s, struct hugetlb_cgroup, css);
> -	return NULL;
> +	return container_of(s, struct hugetlb_cgroup, css);
>  }
>  
>  static inline
> @@ -202,9 +200,6 @@ int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
>  again:
>  	rcu_read_lock();
>  	h_cg = hugetlb_cgroup_from_task(current);
> -	if (!h_cg)
> -		h_cg = root_h_cgroup;
> -
>  	if (!css_tryget(&h_cg->css)) {
>  		rcu_read_unlock();
>  		goto again;
> -- 
> 1.7.10
> 

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2012-06-25 12:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-24 16:45 Aneesh Kumar K.V
2012-06-25 12:14 ` Michal Hocko [this message]

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=20120625121448.GL19805@tiehlicka.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.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