From: Gabriel Paubert <paubert@iram.es>
To: Matthew Dobson <colpatch@us.ibm.com>
Cc: "Martin J. Bligh" <mbligh@aracnet.com>,
Dave Hansen <haveblue@us.ibm.com>,
Bill Hartner <bhartner@us.ibm.com>,
Andrew Theurer <habanero@us.ibm.com>,
Andrew Morton <akpm@zip.com.au>, Robert Love <rml@tech9.net>,
linux-kernel@vger.kernel.org
Subject: Re: [patch] Re: Bug 619 - sched_best_cpu does not pick best cpu (2/2)
Date: Tue, 6 May 2003 13:06:44 +0200 [thread overview]
Message-ID: <20030506110644.GA15131@iram.es> (raw)
In-Reply-To: <3EB70FC2.1010903@us.ibm.com>
On Mon, May 05, 2003 at 06:28:34PM -0700, Matthew Dobson wrote:
> This patch is in regard to bugme.osdl.org bug 619, link here:
>
> http://bugme.osdl.org/show_bug.cgi?id=619
>
> This is the second of two patches to fix this bug. This patch fills in
> include/linux/topology.h (created in the last patch) with a couple
> #defines. The patch also creates a generic_hweight64() in
> include/linux/bitops.h, which we've been lacking for a while. It then
> uses these new macros in sched.c to ensure that if a node has no CPUs,
> it is not used in scheduling decisions.
>
> [mcd@arrakis src]$ diffstat ~/patches/node_online.patch
> include/linux/bitops.h | 27 +++++++++++++++++++++++++++
> include/linux/topology.h | 7 +++++++
> kernel/sched.c | 2 +-
> 3 files changed, 35 insertions(+), 1 deletion(-)
>
> Cheers!
>
> -Matt
> diff -Nur --exclude-from=/home/mcd/.dontdiff linux-2.5.69-add_linux_topo/include/linux/bitops.h linux-2.5.69-node_online_fix/include/linux/bitops.h
> --- linux-2.5.69-add_linux_topo/include/linux/bitops.h Sun May 4 16:53:42 2003
> +++ linux-2.5.69-node_online_fix/include/linux/bitops.h Mon May 5 18:00:00 2003
> @@ -107,6 +107,33 @@
> return (res & 0x0F) + ((res >> 4) & 0x0F);
> }
>
> +#if (BITS_PER_LONG == 64)
> +
> +static inline unsigned int generic_hweight64(unsigned int w)
> +{
> + unsigned int res = (w & 0x5555555555555555) + ((w >> 1) & 0x5555555555555555);
Ignoring the fact that the types are wrong for 64 bit values, you can save
one masking (in all generic_hweight functions in fact) by using the
following expression for the first line:
uxx res = w - ((w>>1) & 0x55...55);
where xx is 8, 16, 32, or 64 and the right number of 5s.
That's an old trick but I can't remember the reference nor
where I found the reference to it, sorry.
Gabriel
next prev parent reply other threads:[~2003-05-06 10:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-06 1:25 [patch] Re: Bug 619 - sched_best_cpu does not pick best cpu (1/2) Matthew Dobson
2003-05-06 1:28 ` [patch] Re: Bug 619 - sched_best_cpu does not pick best cpu (2/2) Matthew Dobson
2003-05-06 2:09 ` David S. Miller
2003-05-06 11:06 ` Gabriel Paubert [this message]
2003-05-15 1:29 ` [patch] Re: Bug 619 - sched_best_cpu does not pick best cpu (1/1) Andrew Theurer
2003-05-15 1:26 ` Zwane Mwaikambo
2003-05-15 1:48 ` Andrew Theurer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030506110644.GA15131@iram.es \
--to=paubert@iram.es \
--cc=akpm@zip.com.au \
--cc=bhartner@us.ibm.com \
--cc=colpatch@us.ibm.com \
--cc=habanero@us.ibm.com \
--cc=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.com \
--cc=rml@tech9.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.