2002-11-13 03:49:11

by Zwane Mwaikambo

[permalink] [raw]
Subject: [PATCH][2.5] smp_init 'CPUS done' looks strange

Also, it would make sense in the future if smp_cpus_done actually gets a
value denoting how many cpus are online.

Zwane

Index: linux-2.5.47/init/main.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.47/init/main.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 main.c
--- linux-2.5.47/init/main.c 11 Nov 2002 03:59:33 -0000 1.1.1.1
+++ linux-2.5.47/init/main.c 13 Nov 2002 03:47:56 -0000
@@ -347,8 +347,8 @@
}

/* Any cleanup work */
- printk("CPUS done %u\n", max_cpus);
- smp_cpus_done(max_cpus);
+ printk("CPUS done %u\n", num_online_cpus());
+ smp_cpus_done(num_online_cpus());
#if 0
/* Get other processors into their bootup holding patterns. */


--
function.linuxpower.ca


2002-11-13 09:31:53

by Rusty Russell

[permalink] [raw]
Subject: Re: [PATCH][2.5] smp_init 'CPUS done' looks strange

In message <Pine.LNX.4.44.0211122246540.24523-100000@montezuma.mastecende.com>
you write:
> Also, it would make sense in the future if smp_cpus_done actually gets a
> value denoting how many cpus are online.

No. Drop the prink by all means, but smp_cpus_done() can call
num_online_cpus() itself. It can't know how many cpus the user
specified, however.

Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

2002-11-13 13:21:42

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: [PATCH][2.5] smp_init 'CPUS done' looks strange

On Wed, 13 Nov 2002, Rusty Russell wrote:

> In message <Pine.LNX.4.44.0211122246540.24523-100000@montezuma.mastecende.com>
> you write:
> > Also, it would make sense in the future if smp_cpus_done actually gets a
> > value denoting how many cpus are online.
>
> No. Drop the prink by all means, but smp_cpus_done() can call
> num_online_cpus() itself. It can't know how many cpus the user
> specified, however.

Doesn't that just encourage more (i = 0; i < NR_CPUS; i++) usage? If you
make max_cpus available to everyone, at least they'll have the correct cpu
count to check against. max_cpus is needed by more than bootup.

Zwane
--
function.linuxpower.ca

2002-11-14 01:30:25

by Rusty Russell

[permalink] [raw]
Subject: Re: [PATCH][2.5] smp_init 'CPUS done' looks strange

In message <Pine.LNX.4.44.0211130820410.24523-100000@montezuma.mastecende.com>
you write:
> On Wed, 13 Nov 2002, Rusty Russell wrote:
>
> > In message <[email protected]
om>
> > you write:
> > > Also, it would make sense in the future if smp_cpus_done actually gets a
> > > value denoting how many cpus are online.
> >
> > No. Drop the prink by all means, but smp_cpus_done() can call
> > num_online_cpus() itself. It can't know how many cpus the user
> > specified, however.
>
> Doesn't that just encourage more (i = 0; i < NR_CPUS; i++) usage? If you
> make max_cpus available to everyone, at least they'll have the correct cpu
> count to check against. max_cpus is needed by more than bootup.

1) CPUs can be nonlinear.
2) They can bring CPUs up after boot.

AM has some cpu iterator patches for those who really care about
efficiently iterating over only online cpus, or only possible cpus.

Hope that helps,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.