[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6D8AF0D@saturn3.aculab.com>
Date: Fri, 9 Dec 2011 14:44:45 -0000
From: "David Laight" <David.Laight@...LAB.COM>
To: "Glauber Costa" <glommer@...allels.com>,
"KAMEZAWA Hiroyuki" <kamezawa.hiroyu@...fujitsu.com>
Cc: <linux-kernel@...r.kernel.org>, <lizf@...fujitsu.com>,
<ebiederm@...ssion.com>, <davem@...emloft.net>,
<gthelen@...gle.com>, <netdev@...r.kernel.org>,
<linux-mm@...ck.org>, <kirill@...temov.name>,
<avagin@...allels.com>, <devel@...nvz.org>,
<eric.dumazet@...il.com>, <cgroups@...r.kernel.org>,
<hannes@...xchg.org>, <mhocko@...e.cz>,
"Paul Menage" <paul@...lmenage.org>
Subject: RE: [PATCH v8 1/9] Basic kernel memory functionality for the Memory Controller
> How about this?
>
> val = !!val;
>
> /*
> * This follows the same hierarchy restrictions than
> * mem_cgroup_hierarchy_write()
> */
> if (!parent || !parent->use_hierarchy) {
> if (list_empty(&cgroup->children))
> memcg->kmem_independent_accounting = val;
> else
> return -EBUSY;
> }
> else
> return -EINVAL;
>
> return 0;
Inverting the tests gives easier to read code:
if (parent && parent->user_hierarchy)
return -EINVAL;
if (!list_empty(&cgroup->children))
return -EBUSY;
memcg->kmem_independent_accounting = val != 0;
return 0;
NFI about the logic...
On the face of it the tests don't seem related to each other
or to the assignment!
David
--
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