From: Nathan Lynch <nathanl@austin.ibm.com>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH 7/7] powerpc numa: Consolidate assignment of cpus to nodes
Date: Tue, 21 Mar 2006 13:16:11 -0600 [thread overview]
Message-ID: <1142968571.27114.28.camel@pants.austin.ibm.com> (raw)
In-Reply-To: <1142966317.10906.172.camel@localhost.localdomain>
On Tue, 2006-03-21 at 10:38 -0800, Dave Hansen wrote:
> On Mon, 2006-03-20 at 18:37 -0600, Nathan Lynch wrote:
> > + cpu_numa_callback(&ppc64_numa_nb, CPU_UP_PREPARE,
> > + (void *)(unsigned long)boot_cpuid);
>
> That double-cast really caught my eye. cpu_numa_callback() looks a
> little bit confused about what type cpuids should be.
>
> Its lcpu is an "unsigned long", but it has integers passed into it
> (boot_cpuid), and calls map_cpu_to_node(lcpu, 0), where the first
> argument is an integer, but an "unsigned long" is passed in. This may
> be harmless, but I still have to think about it, which is bad.
>
> Seems like just making cpu_numa_callback()'s lcpu an int would get rid
> of at least one net cast. Why not just pass &boot_cpuid in there, and
> do this:
>
> int lcpu = *(int *)hcpu;
That's not the convention for cpu hotplug notifiers. The id of the cpu
subject to online/offline is passed in the void * argument. I'd have to
change the cpu hotplug core and every notifier in the kernel to
implement your suggestion.
>
> That makes it _really_ obvious what is going on. While it isn't
> horribly uncommon to pass integers around inside of void*s, it can be a
> bit confusing. You also get readability issues with long<->int
> conversions as you saw.
>
> By the way, what do the "l" and "h" in front of "cpu" mean anyway?
"logical" and "hot"? I dunno, just seemed to be the convention in other
cpu notifiers at the time the code was written.
next prev parent reply other threads:[~2006-03-21 19:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-21 0:33 [PATCH 0/7] powerpc numa updates and fixes Nathan Lynch
2006-03-21 0:34 ` [PATCH 1/7] powerpc numa: fix boot_cpuid always assigned to node 0 Nathan Lynch
2006-03-21 0:34 ` [PATCH 2/7] powerpc numa: Minor debugging code changes Nathan Lynch
2006-03-21 18:27 ` Dave Hansen
2006-03-21 18:54 ` Nathan Lynch
2006-03-21 0:35 ` [PATCH 3/7] powerpc numa: Minor cpu hotplug-related cleanups Nathan Lynch
2006-03-21 0:35 ` [PATCH 4/7] powerpc numa: Get rid of "numa domain" terminology Nathan Lynch
2006-03-21 0:36 ` [PATCH 5/7] powerpc numa: Consolidate handling of Power4 special case Nathan Lynch
2006-03-21 3:54 ` Jon Mason
2006-03-21 0:36 ` [PATCH 6/7] powerpc numa: Support sparse online node map Nathan Lynch
2006-03-21 0:37 ` [PATCH 7/7] powerpc numa: Consolidate assignment of cpus to nodes Nathan Lynch
2006-03-21 18:38 ` Dave Hansen
2006-03-21 19:16 ` Nathan Lynch [this message]
2006-03-21 23:09 ` Michael Ellerman
2006-03-21 23:22 ` Nathan Lynch
2006-03-21 23:34 ` Michael Ellerman
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=1142968571.27114.28.camel@pants.austin.ibm.com \
--to=nathanl@austin.ibm.com \
--cc=haveblue@us.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).