* [PATCH 1/2] smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_init()
@ 2012-05-24 15:10 Srivatsa S. Bhat
2012-05-24 15:11 ` [PATCH 2/2] smpboot, idle: Fix comment mismatch over idle_threads_init() Srivatsa S. Bhat
2012-05-24 21:04 ` [tip:smp/hotplug] smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_init() tip-bot for Srivatsa S. Bhat
0 siblings, 2 replies; 4+ messages in thread
From: Srivatsa S. Bhat @ 2012-05-24 15:10 UTC (permalink / raw)
To: tglx; +Cc: suresh.b.siddha, venki, nikunj, linux-kernel
While trying to initialize idle threads for all cpus, idle_threads_init()
calls smp_processor_id() in a loop, which is unnecessary. The intent
is to initialize idle threads for all non-boot cpus. So just use a variable
to note the boot cpu and use it in the loop.
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---
kernel/smpboot.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index e1a797e..0f2162f 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -52,10 +52,12 @@ static inline void idle_init(unsigned int cpu)
*/
void __init idle_threads_init(void)
{
- unsigned int cpu;
+ unsigned int cpu, boot_cpu;
+
+ boot_cpu = smp_processor_id();
for_each_possible_cpu(cpu) {
- if (cpu != smp_processor_id())
+ if (cpu != boot_cpu)
idle_init(cpu);
}
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] smpboot, idle: Fix comment mismatch over idle_threads_init()
2012-05-24 15:10 [PATCH 1/2] smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_init() Srivatsa S. Bhat
@ 2012-05-24 15:11 ` Srivatsa S. Bhat
2012-05-24 21:05 ` [tip:smp/hotplug] " tip-bot for Srivatsa S. Bhat
2012-05-24 21:04 ` [tip:smp/hotplug] smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_init() tip-bot for Srivatsa S. Bhat
1 sibling, 1 reply; 4+ messages in thread
From: Srivatsa S. Bhat @ 2012-05-24 15:11 UTC (permalink / raw)
To: tglx; +Cc: suresh.b.siddha, venki, nikunj, linux-kernel
The comment over idle_threads_init() really talks about the functionality
of idle_init(). Move that comment to idle_init(), and add a suitable
comment over idle_threads_init().
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---
kernel/smpboot.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 0f2162f..98f60c5 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -31,6 +31,12 @@ void __init idle_thread_set_boot_cpu(void)
per_cpu(idle_threads, smp_processor_id()) = current;
}
+/**
+ * idle_init - Initialize the idle thread for a cpu
+ * @cpu: The cpu for which the idle thread should be initialized
+ *
+ * Creates the thread if it does not exist.
+ */
static inline void idle_init(unsigned int cpu)
{
struct task_struct *tsk = per_cpu(idle_threads, cpu);
@@ -45,10 +51,7 @@ static inline void idle_init(unsigned int cpu)
}
/**
- * idle_thread_init - Initialize the idle thread for a cpu
- * @cpu: The cpu for which the idle thread should be initialized
- *
- * Creates the thread if it does not exist.
+ * idle_threads_init - Initialize idle threads for all cpus
*/
void __init idle_threads_init(void)
{
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:smp/hotplug] smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_init()
2012-05-24 15:10 [PATCH 1/2] smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_init() Srivatsa S. Bhat
2012-05-24 15:11 ` [PATCH 2/2] smpboot, idle: Fix comment mismatch over idle_threads_init() Srivatsa S. Bhat
@ 2012-05-24 21:04 ` tip-bot for Srivatsa S. Bhat
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Srivatsa S. Bhat @ 2012-05-24 21:04 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, srivatsa.bhat, tglx
Commit-ID: ee74d13229fb606353ff56f4927fa93b37e95bbe
Gitweb: http://git.kernel.org/tip/ee74d13229fb606353ff56f4927fa93b37e95bbe
Author: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
AuthorDate: Thu, 24 May 2012 20:40:55 +0530
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 24 May 2012 22:58:08 +0200
smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_init()
While trying to initialize idle threads for all cpus, idle_threads_init()
calls smp_processor_id() in a loop, which is unnecessary. The intent
is to initialize idle threads for all non-boot cpus. So just use a variable
to note the boot cpu and use it in the loop.
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: suresh.b.siddha@intel.com
Cc: venki@google.com
Cc: nikunj@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/20120524151055.2549.64309.stgit@srivatsabhat.in.ibm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/smpboot.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index e1a797e..0f2162f 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -52,10 +52,12 @@ static inline void idle_init(unsigned int cpu)
*/
void __init idle_threads_init(void)
{
- unsigned int cpu;
+ unsigned int cpu, boot_cpu;
+
+ boot_cpu = smp_processor_id();
for_each_possible_cpu(cpu) {
- if (cpu != smp_processor_id())
+ if (cpu != boot_cpu)
idle_init(cpu);
}
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:smp/hotplug] smpboot, idle: Fix comment mismatch over idle_threads_init()
2012-05-24 15:11 ` [PATCH 2/2] smpboot, idle: Fix comment mismatch over idle_threads_init() Srivatsa S. Bhat
@ 2012-05-24 21:05 ` tip-bot for Srivatsa S. Bhat
0 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Srivatsa S. Bhat @ 2012-05-24 21:05 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, srivatsa.bhat, tglx
Commit-ID: 4a70d2d9909b43ed88043b98cabe2c7fbd563021
Gitweb: http://git.kernel.org/tip/4a70d2d9909b43ed88043b98cabe2c7fbd563021
Author: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
AuthorDate: Thu, 24 May 2012 20:41:00 +0530
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 24 May 2012 22:58:08 +0200
smpboot, idle: Fix comment mismatch over idle_threads_init()
The comment over idle_threads_init() really talks about the functionality
of idle_init(). Move that comment to idle_init(), and add a suitable
comment over idle_threads_init().
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: suresh.b.siddha@intel.com
Cc: venki@google.com
Cc: nikunj@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/20120524151100.2549.66501.stgit@srivatsabhat.in.ibm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/smpboot.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 0f2162f..98f60c5 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -31,6 +31,12 @@ void __init idle_thread_set_boot_cpu(void)
per_cpu(idle_threads, smp_processor_id()) = current;
}
+/**
+ * idle_init - Initialize the idle thread for a cpu
+ * @cpu: The cpu for which the idle thread should be initialized
+ *
+ * Creates the thread if it does not exist.
+ */
static inline void idle_init(unsigned int cpu)
{
struct task_struct *tsk = per_cpu(idle_threads, cpu);
@@ -45,10 +51,7 @@ static inline void idle_init(unsigned int cpu)
}
/**
- * idle_thread_init - Initialize the idle thread for a cpu
- * @cpu: The cpu for which the idle thread should be initialized
- *
- * Creates the thread if it does not exist.
+ * idle_threads_init - Initialize idle threads for all cpus
*/
void __init idle_threads_init(void)
{
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-24 21:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-24 15:10 [PATCH 1/2] smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_init() Srivatsa S. Bhat
2012-05-24 15:11 ` [PATCH 2/2] smpboot, idle: Fix comment mismatch over idle_threads_init() Srivatsa S. Bhat
2012-05-24 21:05 ` [tip:smp/hotplug] " tip-bot for Srivatsa S. Bhat
2012-05-24 21:04 ` [tip:smp/hotplug] smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_init() tip-bot for Srivatsa S. Bhat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome