export cpu_online_map
PATCH 1/1 export cpu_online_map
From: Andrew Morton <[email protected]>
With CONFIG_SMP=n:
*** Warning: "cpu_online_map" [drivers/firmware/dcdbas.ko] undefined!
due to set_cpus_allowed().
Questions:
- Why isn't set_cpus_allowed() just a no-op on UP? Or some trivial thing which tests for cpu #0?
- Why does cpu_online_map even exist on CONFIG_SMP=n?
---
kernel/sched.c | 1 + 1 files changed, 1 insertion(+)
kernel/sched.c renamed from kernel/sched.c~export-cpu_online_map +1 -0
@@ -3879,6 +3879,7 @@ EXPORT_SYMBOL(cpu_present_map);#ifndef CONFIG_SMP cpumask_t cpu_online_map =CPU_MASK_ALL ; +EXPORT_SYMBOL (cpu_online_map);cpumask_t cpu_possible_map =CPU_MASK_ALL ;#endif
_
Andrew asked:
Quoted 2 lines
- Why isn't
set_cpus_allowed()just a no-op on UP? Or some trivial thing which tests for cpu #0?
I don't know.
By scanning random copies of kernels left on my drive, I can see that it changed from a trivial "return 0" to the more interesting check using cpu_online_map in one of your "linus.patch" patches in the release 2.6.11-rc1-mm2.
But I don't know how to get to the history at this point to see what happened.
It looks like Linus started the git history at 2.6.12-rc2.
Could someone clue me in on how to find Linux history BG (before-git)?
Since bk no longer works for me, I have no idea how to access any history prior to about 2.6.12-rc2. Ugh.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 15 lines · Paul Jackson
Andrew asked:
Quoted 2 lines
- Why isn't
set_cpus_allowed()just a no-op on UP? Or some trivial thing which tests for cpu #0?I don't know.
By scanning random copies of kernels left on my drive, I can see that it changed from a trivial "return 0" to the more interesting check using
cpu_online_mapin one of your "linus.patch" patches in the release 2.6.11-rc1-mm2.But I don't know how to get to the history at this point to see what happened.
Quoted 6 lines
It looks like Linus started the git history at 2.6.12-rc2.
Could someone clue me in on how to find Linux history BG (before-git)?
Since bk no longer works for me, I have no idea how to access any history prior to about 2.6.12-rc2. Ugh.
There's still bkbits.net:
From: Rusty Russell <[email protected]>
Return EINVAL for invalid sched_setaffinity on UP. I was a little surprised that sys_sched_setaffinity for CPU 1 didn't fail on my UP box. With CONFIG_SMP it would have.
---
25-akpm/include/linux/sched.h | 3 +++ 1 files changed, 3 insertions(+)
include/linux/sched.h renamed from include/linux/sched.h~sys_sched_setaffinity-on-up-should-fail-for-non-zero +3 -0
@@ -13,6 +13,7 @@#include <linux/rbtree.h> #include <linux/thread_info.h> #include <linux/cpumask.h> +#include <linux/errno.h> #include <asm/system.h> #include <asm/semaphore.h>
@@ -732,6 +733,8 @@ extern int set_cpus_allowed(task_t *p, c#else static inline int set_cpus_allowed (task_t *p,cpumask_t new_mask) { +if (!cpus_intersects (new_mask, cpu_online_map)) +return -EINVAL ;return 0 ; }#endif
_
Seems silly to use cpu_online_map to test for `1'?
Quoted 6 lines · Andrew
Quoted 2 lines
Since bk no longer works for me, I have no idea how to access any history prior to about 2.6.12-rc2. Ugh.
There's still bkbits.net:
Ok - that helps. Thanks.
There is also an hg (mercurial) web based Linux history at:
http://www.kernel.org/hg/linux-2.6/
I still don't see something I can download into a local hg or git repository -- if a lurker knows how that is done, I'd be glad to know.
Quoted 1 line
Seems silly to use
cpu_online_mapto test for `1'?
Yeah - agreed. The include/linux/cpumask.h stuff hardcodes the UP (NR_CPUS==1) code to plain old 0's and 1's. This macro should do so as well.
I just sent a patch.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 11 lines · Paul Jackson
Quoted 6 lines · Andrew
Quoted 2 lines
Since bk no longer works for me, I have no idea how to access any history prior to about 2.6.12-rc2. Ugh.
There's still bkbits.net:
Ok - that helps. Thanks.
Quoted 8 lines
There is also an hg (mercurial) web based Linux history at:
http://www.kernel.org/hg/linux-2.6/
I still don't see something I can download into a local hg or git repository -- if a lurker knows how that is done, I'd be glad to know.
I think there are ways of getting the entire kernel history in git too.
I usually just grep my patches directory, actually. <looks>. <egad>. 27,000 of them.
Quoted 9 lines
Quoted 2 lines
Seems silly to use
cpu_online_mapto test for `1'?Yeah - agreed. The
include/linux/cpumask.hstuff hardcodes the UP (NR_CPUS==1) code to plain old 0's and 1's. This macro should do so as well.I just sent a patch.
Sweet, thanks. Perhaps we can remove cpu_online_map from UP builds soon - it's really wrong to have it there.
Quoted 2 lines · Andrew
Sweet, thanks. Perhaps we can remove
cpu_online_mapfrom UP builds soon - it's really wrong to have it there.
Eh ... my gut reaction is different. Even uni-processors have
online cpus - just not very many of them (and hot unplugging one of them is frowned on). Why make special cases when it serves no purpose?
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 8 lines · Paul Jackson
Quoted 2 lines · Andrew
Sweet, thanks. Perhaps we can remove
cpu_online_mapfrom UP builds soon - it's really wrong to have it there.Eh ... my gut reaction is different. Even uni-processors have
online cpus - just not very many of them (and hot unplugging one of them is frowned on).
That's daft. A uniprocessor machine has one and only one CPU and it's
always online! An online_map is only needed for MP.
Now conceptually, yes, we should be able to query and perhaps set the onlineness of a CPU. But that doesn't mean that we should have storage which idiotically remembers something which was known at compile time.
Quoted 1 line
Why make special cases when it serves no purpose?
Ths presence of cpu_online_map in UP builds _is_ a special case. The kernel's overall approach to such things is to optimise them away at compile time for !SMP builds.
Quoted 1 line
That's daft.
<grin>
Ok - guess I'll let someone else handle the patches for that change then. Looks like I am not not singing in key on this one.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.650.933.1373, 1.925.600.0401Quoted 1 line · Andrew
I think there are ways of getting the entire kernel history in git too.
If I knew where a history was, perhaps I could put it into git (or the one I prefer - hg).
The only 3 histories I can find are:
1) web based bk
2) web based hg
3) locked forever inside my dead bk repositories
Quoted 2 lines
I usually just grep my patches directory, actually. <looks>. <egad>. 27,000 of them.
Well - I've got my email archives from the mm-commits email list, but that only goes back to July of 2005 .. a mere 4547 of them.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 6 lines · Paul Jackson
It looks like Linus started the git history at 2.6.12-rc2.
Could someone clue me in on how to find Linux history BG (before-git)?
Since bk no longer works for me, I have no idea how to access any history prior to about 2.6.12-rc2. Ugh.
Linus put the old BK history (2.5.0 - 2.6.12-rc2) in:
http://kernel.org/git/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git
Quoted 2 lines · Diego
Linus put the old BK history (2.5.0 - 2.6.12-rc2) in:
http://kernel.org/git/?p=linux/kernel/git/torvalds/old-2.6-bkcvs.git
Lurkers to the rescue. Thank-you.
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401Quoted 3 lines · [email protected] wrote:
- Why isn't
set_cpus_allowed()just a no-op on UP? Or some trivial thing which tests for cpu #0?
It's still needed to weed out bogus masks that have CPU 0 turned off.
You're right that it doesn't need to check cpu_online_map though. Here is a patch to make it check for CPU 0 instead.
Cheers,
Signature · 5 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--include/linux/sched.h +1 -1
@@ -895,7 +895,7 @@ extern int set_cpus_allowed(task_t *p, c#else static inline int set_cpus_allowed (task_t *p,cpumask_t new_mask) { -if (!cpus_intersects (new_mask, cpu_online_map)) +if (!cpu_isset (0 , new_mask))return -EINVAL ;return 0 ; }