|
@@ -1890,8 +1890,9 @@ asmlinkage int vprintk_emit(int facility, int level,
|
|
|
const char *fmt, va_list args)
|
|
|
{
|
|
|
int printed_len;
|
|
|
- bool in_sched = false;
|
|
|
+ bool in_sched = false, pending_output;
|
|
|
unsigned long flags;
|
|
|
+ u64 curr_log_seq;
|
|
|
|
|
|
if (level == LOGLEVEL_SCHED) {
|
|
|
level = LOGLEVEL_DEFAULT;
|
|
@@ -1903,11 +1904,13 @@ asmlinkage int vprintk_emit(int facility, int level,
|
|
|
|
|
|
/* This stops the holder of console_sem just where we want him */
|
|
|
logbuf_lock_irqsave(flags);
|
|
|
+ curr_log_seq = log_next_seq;
|
|
|
printed_len = vprintk_store(facility, level, dict, dictlen, fmt, args);
|
|
|
+ pending_output = (curr_log_seq != log_next_seq);
|
|
|
logbuf_unlock_irqrestore(flags);
|
|
|
|
|
|
/* If called from the scheduler, we can not call up(). */
|
|
|
- if (!in_sched) {
|
|
|
+ if (!in_sched && pending_output) {
|
|
|
/*
|
|
|
* Disable preemption to avoid being preempted while holding
|
|
|
* console_sem which would prevent anyone from printing to
|
|
@@ -1924,7 +1927,8 @@ asmlinkage int vprintk_emit(int facility, int level,
|
|
|
preempt_enable();
|
|
|
}
|
|
|
|
|
|
- wake_up_klogd();
|
|
|
+ if (pending_output)
|
|
|
+ wake_up_klogd();
|
|
|
return printed_len;
|
|
|
}
|
|
|
EXPORT_SYMBOL(vprintk_emit);
|