All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Barbieri <ldb@ldb.ods.org>
To: Linux-Kernel ML <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@transmeta.com>
Subject: [PATCH] [2.5] is_smp() and can_be_smp()
Date: 17 Aug 2002 15:11:58 +0200	[thread overview]
Message-ID: <1029589918.1996.28.camel@ldb> (raw)

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

Will be used by another patch that I'll post in the near future.
For i386 cpucount is used rather than computing the hweight of
cpu_online_map since it's faster and already there.
Ideally the same should be done for all architectures in both these
macros and num_online_cpus and num_possible_cpus.


diff --exclude-from=/home/ldb/src/linux-exclude -urNdp a/include/asm-i386/smp.h b/include/asm-i386/smp.h
--- a/include/asm-i386/smp.h	2002-08-13 19:36:13.000000000 +0200
+++ b/include/asm-i386/smp.h	2002-08-17 14:45:50.000000000 +0200
@@ -95,6 +95,10 @@ extern inline unsigned int num_online_cp
 	return hweight32(cpu_online_map);
 }
 
+extern int cpucount;
+#define is_smp() (cpucount)
+#define can_be_smp() (cpucount)
+
 extern inline int any_online_cpu(unsigned int mask)
 {
 	if (mask & cpu_online_map)
diff --exclude-from=/home/ldb/src/linux-exclude -urNdp a/include/linux/smp.h b/include/linux/smp.h
--- a/include/linux/smp.h	2002-08-13 19:58:12.000000000 +0200
+++ b/include/linux/smp.h	2002-08-16 04:57:31.000000000 +0200
@@ -78,6 +78,19 @@ extern int register_cpu_notifier(struct 
 extern void unregister_cpu_notifier(struct notifier_block *nb);
 
 int cpu_up(unsigned int cpu);
+
+#ifndef is_smp
+#define is_smp() (num_online_cpus() > 1)
+#endif
+
+#ifndef can_be_smp
+#ifdef num_possible_cpus
+#define can_be_smp() (num_possible_cpus() > 1)
+#else
+#define can_be_smp() is_smp()
+#endif
+#endif
+
 #else /* !SMP */
 
 /*
@@ -96,6 +109,8 @@ static inline void smp_send_reschedule_a
 #define cpu_online_map				1
 #define cpu_online(cpu)				({ cpu; 1; })
 #define num_online_cpus()			1
+#define is_smp()				0
+#define can_be_smp()				0
 #define __per_cpu_data
 #define per_cpu(var, cpu)			var
 #define this_cpu(var)				var


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

                 reply	other threads:[~2002-08-17 13:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1029589918.1996.28.camel@ldb \
    --to=ldb@ldb.ods.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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.