public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpuset.c : Removes extra variable
@ 2008-08-06 12:50 Rakib Mullick
  2008-08-06 20:22 ` Paul Jackson
  2008-08-07  5:02 ` Paul Jackson
  0 siblings, 2 replies; 3+ messages in thread
From: Rakib Mullick @ 2008-08-06 12:50 UTC (permalink / raw)
  To: pj, menage; +Cc: linux-kernel

Hello everyone, the following patch removes the use of int
cpus_nonempty variable from 'update_flag' function.

Thanks.

Signed-off-by: Md.Rakib H. Mullick (rakib.mullick@gmail.com)

--- linux-2.6.27-rc2.orig/kernel/cpuset.c	2008-08-06 16:23:26.000000000 +0600
+++ linux-2.6.27-rc2/kernel/cpuset.c	2008-08-06 18:03:50.000000000 +0600
@@ -1110,7 +1110,7 @@ static int update_flag(cpuset_flagbits_t
 {
 	struct cpuset trialcs;
 	int err;
-	int cpus_nonempty, balance_flag_changed;
+	int balance_flag_changed;

 	trialcs = *cs;
 	if (turning_on)
@@ -1122,7 +1122,6 @@ static int update_flag(cpuset_flagbits_t
 	if (err < 0)
 		return err;

-	cpus_nonempty = !cpus_empty(trialcs.cpus_allowed);
 	balance_flag_changed = (is_sched_load_balance(cs) !=
 		 			is_sched_load_balance(&trialcs));

@@ -1130,7 +1129,7 @@ static int update_flag(cpuset_flagbits_t
 	cs->flags = trialcs.flags;
 	mutex_unlock(&callback_mutex);

-	if (cpus_nonempty && balance_flag_changed)
+	if (!cpus_empty(trialcs.cpus_allowed) && balance_flag_changed)
 		rebuild_sched_domains();

 	return 0;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpuset.c : Removes extra variable
  2008-08-06 12:50 [PATCH] cpuset.c : Removes extra variable Rakib Mullick
@ 2008-08-06 20:22 ` Paul Jackson
  2008-08-07  5:02 ` Paul Jackson
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Jackson @ 2008-08-06 20:22 UTC (permalink / raw)
  To: Rakib Mullick; +Cc: menage, linux-kernel

Rabik wrote:
> removes ... cpus_nonempty variable

No.

Sorry - I must NAQ this patch.  I intentionally add inessential
variables such as this in order to make the code easier to read.

I consider the line of code:

	if (cpus_nonempty && balance_flag_changed)

to be more readable than the line of clde:

	if (!cpus_empty(trialcs.cpus_allowed) && balance_flag_changed)

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.940.382.4214

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpuset.c : Removes extra variable
  2008-08-06 12:50 [PATCH] cpuset.c : Removes extra variable Rakib Mullick
  2008-08-06 20:22 ` Paul Jackson
@ 2008-08-07  5:02 ` Paul Jackson
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Jackson @ 2008-08-07  5:02 UTC (permalink / raw)
  To: Rakib Mullick; +Cc: menage, linux-kernel


  Andrew - I reverse my 'NAQ' on this patch.

Acked-by: Paul Jackson <pj@sgi.com>


Rakib wrote:
> I think we should concentrate on how it will be executed.

Aha - you're right.  Your patch saves 12 bytes of kernel
text space (x86_64 arch).  I had assumed that the compiler
would optimize my inessential cpus_nonempty variable out of
existence, but that is not the case.

Thanks for persuing this, Rakib.

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <pj@sgi.com> 1.940.382.4214

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-07  5:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-06 12:50 [PATCH] cpuset.c : Removes extra variable Rakib Mullick
2008-08-06 20:22 ` Paul Jackson
2008-08-07  5:02 ` Paul Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox