lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140924154934.GA9670@cmpxchg.org>
Date:	Wed, 24 Sep 2014 11:49:34 -0400
From:	Johannes Weiner <hannes@...xchg.org>
To:	Vladimir Davydov <vdavydov@...allels.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Michal Hocko <mhocko@...e.cz>, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org
Subject: Re: [PATCH -mm] memcg: zap memcg_can_account_kmem

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@...allels.com>

Yes, the two checks look indeed redundant.

Acked-by: Johannes Weiner <hannes@...xchg.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ