Skip to contentSkip to conversation

cpuset: minor code refinements

PATCH New Paul Jackson 1 participant 1 message Oct 19, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpuset: minor code refinements

From: Paul Jackson <[email protected]>

A couple of minor code simplifications to the kernel/cpuset.c code. No functional change. Just a little less code and a little more readable.

---
 kernel/cpuset.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
kernel/cpuset.c +4 -5
@@ -729,9 +729,11 @@ static int validate_change(const struct 
 	}
 
 	/* Remaining checks don't apply to root cpuset */
-	if ((par = cur->parent) == NULL)
+	if (cur == &top_cpuset)
 		return 0;
 
+	par = cur->parent;
+
 	/* We must be a subset of our parent cpuset */
 	if (!is_cpuset_subset(trial, par))
 		return -EACCES;
@@ -1060,10 +1062,7 @@ static int update_flag(cpuset_flagbits_t
 	cpu_exclusive_changed =
 		(is_cpu_exclusive(cs) != is_cpu_exclusive(&trialcs));
 	mutex_lock(&callback_mutex);
-	if (turning_on)
-		set_bit(bit, &cs->flags);
-	else
-		clear_bit(bit, &cs->flags);
+	cs->flags = trialcs.flags;
 	mutex_unlock(&callback_mutex);
 
 	if (cpu_exclusive_changed)
Signature · 3 lines
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[email protected]> 1.925.600.0401