From: Ravikiran G Thirumalai <kiran@in.ibm.com>
To: Robert Love <rml@tech9.net>
Cc: linux-kernel@vger.kernel.org
Subject: [patch] get/put_cpu in up need not disable preemption
Date: Sat, 9 Nov 2002 15:36:34 +0530 [thread overview]
Message-ID: <20021109153634.M2298@in.ibm.com> (raw)
AFAICS, get_cpu, put_cpu and put_cpu_no_resched need not disable
preemption on a uniprocessor. Foll patch removes the disable/enable
premeption stuff for the UP case. Tested on a PIII 4 way for both
UP and SMP configs. Pls apply.
Thanks,
Kiran
diff -ruN -X dontdiff linux-2.5.46/include/linux/smp.h get_cpu-2.5.46/include/linux/smp.h
--- linux-2.5.46/include/linux/smp.h Tue Nov 5 04:00:31 2002
+++ get_cpu-2.5.46/include/linux/smp.h Sat Nov 9 12:27:46 2002
@@ -78,6 +78,11 @@
extern void unregister_cpu_notifier(struct notifier_block *nb);
int cpu_up(unsigned int cpu);
+
+#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
+#define put_cpu() preempt_enable()
+#define put_cpu_no_resched() preempt_enable_no_resched()
+
#else /* !SMP */
/*
@@ -106,10 +111,11 @@
static inline void unregister_cpu_notifier(struct notifier_block *nb)
{
}
-#endif /* !SMP */
-#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
-#define put_cpu() preempt_enable()
-#define put_cpu_no_resched() preempt_enable_no_resched()
+#define get_cpu() smp_processor_id()
+#define put_cpu() do { } while (0)
+#define put_cpu_no_resched() do { } while (0)
+
+#endif /* !SMP */
#endif /* __LINUX_SMP_H */
next reply other threads:[~2002-11-09 9:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-09 10:06 Ravikiran G Thirumalai [this message]
2002-11-09 18:53 ` [patch] get/put_cpu in up need not disable preemption Robert Love
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=20021109153634.M2298@in.ibm.com \
--to=kiran@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox