diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2014-12-11 09:12:01 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-12-11 09:12:01 -0500 |
commit | 1fb8915b9876a80f43732980208b39d013f8da9d (patch) | |
tree | 73a82f42c9601dd1155092ff7283476fe9d625e6 /kernel/printk | |
parent | db0865543739b3edb2ee9bf340380cf4986b58ff (diff) |
printk: Do not disable preemption for accessing printk_func
As printk_func will either be the default function, or a per_cpu function
for the current CPU, there's no reason to disable preemption to access
it from printk. That's because if the printk_func is not the default
then the caller had better disabled preemption as they were the one to
change it.
Link: http://lkml.kernel.org/r/CA+55aFz5-_LKW4JHEBoWinN9_ouNcGRWAF2FUA35u46FRN-Kxw@mail.gmail.com
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/printk.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 5af2b8bc88f0..9b896e7a50a9 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -1859,10 +1859,16 @@ asmlinkage __visible int printk(const char *fmt, ...) | |||
1859 | int r; | 1859 | int r; |
1860 | 1860 | ||
1861 | va_start(args, fmt); | 1861 | va_start(args, fmt); |
1862 | preempt_disable(); | 1862 | |
1863 | /* | ||
1864 | * If a caller overrides the per_cpu printk_func, then it needs | ||
1865 | * to disable preemption when calling printk(). Otherwise | ||
1866 | * the printk_func should be set to the default. No need to | ||
1867 | * disable preemption here. | ||
1868 | */ | ||
1863 | vprintk_func = this_cpu_read(printk_func); | 1869 | vprintk_func = this_cpu_read(printk_func); |
1864 | r = vprintk_func(fmt, args); | 1870 | r = vprintk_func(fmt, args); |
1865 | preempt_enable(); | 1871 | |
1866 | va_end(args); | 1872 | va_end(args); |
1867 | 1873 | ||
1868 | return r; | 1874 | return r; |