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: <20120719092911.GA2606@shutemov.name>
Date:	Thu, 19 Jul 2012 12:29:11 +0300
From:	"Kirill A. Shutemov" <kirill@...temov.name>
To:	Wanpeng Li <liwanp@...ux.vnet.ibm.com>
Cc:	linux-mm@...ck.org, Michal Hocko <mhocko@...e.cz>,
	Johannes Weiner <hannes@...xchg.org>,
	KAMEZAWAHiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Gavin Shan <shangw@...ux.vnet.ibm.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/memcg: wrap mem_cgroup_from_css function

On Thu, Jul 19, 2012 at 05:23:09PM +0800, Wanpeng Li wrote:
> On Thu, Jul 19, 2012 at 12:14:20PM +0300, Kirill A. Shutemov wrote:
> >On Wed, Jul 18, 2012 at 11:05:30AM +0800, Wanpeng Li wrote:
> >> wrap mem_cgroup_from_css function to clarify get mem cgroup
> >> from cgroup_subsys_state.
> >> 
> >> Signed-off-by: Wanpeng Li <liwanp@...ux.vnet.ibm.com>
> >> Cc: Michal Hocko <mhocko@...e.cz>
> >> Cc: Johannes Weiner <hannes@...xchg.org>
> >> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
> >> Cc: Andrew Morton <akpm@...ux-foundation.org>
> >> Cc: Gavin Shan <shangw@...ux.vnet.ibm.com>
> >> Cc: Wanpeng Li <liwanp@...ux.vnet.ibm.com>
> >> Cc: linux-kernel@...r.kernel.org
> >> ---
> >>  mm/memcontrol.c |   14 ++++++++++----
> >>  1 files changed, 10 insertions(+), 4 deletions(-)
> >> 
> >> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> >> index 58a08fc..20f6a15 100644
> >> --- a/mm/memcontrol.c
> >> +++ b/mm/memcontrol.c
> >> @@ -396,6 +396,12 @@ static void mem_cgroup_put(struct mem_cgroup *memcg);
> >>  #include <net/sock.h>
> >>  #include <net/ip.h>
> >>  
> >> +static inline
> >> +struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s)
> >> +{
> >> +	return container_of(s, struct mem_cgroup, css);
> >> +}
> >> +
> >>  static bool mem_cgroup_is_root(struct mem_cgroup *memcg);
> >>  void sock_update_memcg(struct sock *sk)
> >>  {
> >> @@ -820,7 +826,7 @@ static void memcg_check_events(struct mem_cgroup *memcg, struct page *page)
> >>  
> >>  struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont)
> >>  {
> >> -	return container_of(cgroup_subsys_state(cont,
> >> +	return mem_cgroup_from_css(cgroup_subsys_state(cont,
> >>  				mem_cgroup_subsys_id), struct mem_cgroup,
> >>  				css);
> >
> >Hm?.. Here and below too many args to mem_cgroup_from_css().
> >Have you tested the code?
> 
> Hi, what's the meaning of "two many"?
> 
> cgroup_subsys_state(cont, mem_cgroup_subsys_id) and 
> task_subsys_state(p, mem_cgroup_subsys_id) both are 
> just one arg in mem_cgroup_from_css. :-)

Em.. I guess my eyes are broken. %)

By the patch I see that mem_cgroup_from_css() here has tree arguments:

1. cgroup_subsys_state(cont, mem_cgroup_subsys_id)
2. struct mem_cgroup
3. css

Where's my parser is broken?

-- 
 Kirill A. Shutemov
--
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