linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Yang Shi <yang.shi@linux.alibaba.com>
Cc: ying.huang@intel.com, tim.c.chen@intel.com,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: swap: use mem_cgroup_is_root() instead of deferencing css->parent
Date: Fri, 11 Jan 2019 20:11:08 +0100	[thread overview]
Message-ID: <20190111191108.GK14956@dhcp22.suse.cz> (raw)
In-Reply-To: <1547232913-118148-1-git-send-email-yang.shi@linux.alibaba.com>

On Sat 12-01-19 02:55:13, Yang Shi wrote:
> mem_cgroup_is_root() is preferred API to check if memcg is root or not.
> Use it instead of deferencing css->parent.
> 
> Cc: Huang Ying <ying.huang@intel.com>
> Cc: Tim Chen <tim.c.chen@intel.com>
> Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>

Yes, this is more readable.

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  include/linux/swap.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/swap.h b/include/linux/swap.h
> index a8f6d5d..8739063 100644
> --- a/include/linux/swap.h
> +++ b/include/linux/swap.h
> @@ -623,7 +623,7 @@ static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
>  		return vm_swappiness;
>  
>  	/* root ? */
> -	if (mem_cgroup_disabled() || !memcg->css.parent)
> +	if (mem_cgroup_disabled() || mem_cgroup_is_root(memcg))
>  		return vm_swappiness;
>  
>  	return memcg->swappiness;
> -- 
> 1.8.3.1

-- 
Michal Hocko
SUSE Labs

      reply	other threads:[~2019-01-11 19:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11 18:55 Yang Shi
2019-01-11 19:11 ` 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=20190111191108.GK14956@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tim.c.chen@intel.com \
    --cc=yang.shi@linux.alibaba.com \
    --cc=ying.huang@intel.com \
    /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