> 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 _______________________________________________ Devel mailing list Devel@openvz.org https://openvz.org/mailman/listinfo/devel