Thread (29 messages) flat view 29 messages, 3 authors, 2011-12-12

RE: [PATCH v8 1/9] Basic kernel memory functionality for the Memory Controller

From: David Laight <hidden>
Date: 2011-12-09 14:45:01
Also in: cgroups, linux-mm, lkml

 
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, 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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help