From: Johannes Weiner <hannes@cmpxchg.org>
To: Vladimir Davydov <vdavydov@parallels.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.cz>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH -mm] memcg: zap memcg_can_account_kmem
Date: Wed, 24 Sep 2014 11:49:34 -0400 [thread overview]
Message-ID: <20140924154934.GA9670@cmpxchg.org> (raw)
In-Reply-To: <1411570361-29361-1-git-send-email-vdavydov@parallels.com>
On Wed, Sep 24, 2014 at 06:52:41PM +0400, Vladimir Davydov wrote:
> memcg_can_account_kmem() returns true iff
>
> !mem_cgroup_disabled() && !mem_cgroup_is_root(memcg) &&
> memcg_kmem_is_active(memcg);
>
> To begin with the !mem_cgroup_is_root(memcg) check is useless, because
> one can't enable kmem accounting for the root cgroup (mem_cgroup_write()
> returns EINVAL on an attempt to set the limit on the root cgroup).
>
> Furthermore, the !mem_cgroup_disabled() check also seems to be
> redundant. The point is memcg_can_account_kmem() is called from three
> places: mem_cgroup_salbinfo_read(), __memcg_kmem_get_cache(), and
> __memcg_kmem_newpage_charge(). The latter two functions are only invoked
> if memcg_kmem_enabled() returns true, which implies that the memory
> cgroup subsystem is enabled. And mem_cgroup_slabinfo_read() shows the
> output of memory.kmem.slabinfo, which won't exist if the memory cgroup
> is completely disabled.
>
> So let's substitute all the calls to memcg_can_account_kmem() with plain
> memcg_kmem_is_active(), and kill the former.
>
> Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Yes, the two checks look indeed redundant.
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
--
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>
prev parent reply other threads:[~2014-09-24 15:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-24 14:52 [PATCH -mm] memcg: zap memcg_can_account_kmem Vladimir Davydov
2014-09-24 15:49 ` Johannes Weiner [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=20140924154934.GA9670@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=vdavydov@parallels.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;
as well as URLs for NNTP newsgroup(s).