Commit 6551f0aa authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] current_is_keventd() speedup

From: Srivatsa Vaddagiri <vatsa@in.ibm.com>

current_is_keventd() doesn't need to search across all the CPUs to identify
itself.
parent 127419b1
...@@ -333,16 +333,17 @@ int keventd_up(void) ...@@ -333,16 +333,17 @@ int keventd_up(void)
int current_is_keventd(void) int current_is_keventd(void)
{ {
struct cpu_workqueue_struct *cwq; struct cpu_workqueue_struct *cwq;
int cpu; int cpu = smp_processor_id(); /* preempt-safe: keventd is per-cpu */
int ret = 0;
BUG_ON(!keventd_wq); BUG_ON(!keventd_wq);
for_each_cpu(cpu) { cwq = keventd_wq->cpu_wq + cpu;
cwq = keventd_wq->cpu_wq + cpu; if (current == cwq->thread)
if (current == cwq->thread) ret = 1;
return 1;
} return ret;
return 0;
} }
void init_workqueues(void) void init_workqueues(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment