linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Petr Mladek <pmladek@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrea Parri <parri.andrea@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Paul McKenney <paulmck@kernel.org>,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH v5 3/4] Revert "printk: lock/unlock console only for new logbuf entries"
Date: Thu,  9 Jul 2020 15:29:43 +0206	[thread overview]
Message-ID: <20200709132344.760-4-john.ogness@linutronix.de> (raw)
In-Reply-To: <20200709132344.760-1-john.ogness@linutronix.de>

This reverts commit 3ac37a93fa9217e576bebfd4ba3e80edaaeb2289.

This optimization will not apply once the transition to a lockless
printk is complete. Rather than porting this optimization through
the transition only to remove it anyway, just revert it now to
simplify the transition.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
---
 kernel/printk/printk.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index b71eaf5f5a86..1b41e1b98221 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1981,9 +1981,8 @@ asmlinkage int vprintk_emit(int facility, int level,
 			    const char *fmt, va_list args)
 {
 	int printed_len;
-	bool in_sched = false, pending_output;
+	bool in_sched = false;
 	unsigned long flags;
-	u64 curr_log_seq;
 
 	/* Suppress unimportant messages after panic happens */
 	if (unlikely(suppress_printk))
@@ -1999,13 +1998,11 @@ 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 && pending_output) {
+	if (!in_sched) {
 		/*
 		 * Disable preemption to avoid being preempted while holding
 		 * console_sem which would prevent anyone from printing to
@@ -2022,8 +2019,7 @@ asmlinkage int vprintk_emit(int facility, int level,
 		preempt_enable();
 	}
 
-	if (pending_output)
-		wake_up_klogd();
+	wake_up_klogd();
 	return printed_len;
 }
 EXPORT_SYMBOL(vprintk_emit);
-- 
2.20.1


  parent reply	other threads:[~2020-07-09 13:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 13:23 [PATCH v5 0/4] printk: replace ringbuffer John Ogness
2020-07-09 13:23 ` [PATCH v5 1/4] crash: add VMCOREINFO macro to define offset in a struct declared by typedef John Ogness
2020-07-09 13:23 ` [PATCH v5 2/4] printk: add lockless ringbuffer John Ogness
2020-07-10  8:43   ` Sergey Senozhatsky
2020-07-10  8:47     ` Sergey Senozhatsky
2020-07-09 13:23 ` John Ogness [this message]
2020-07-09 13:23 ` [PATCH v5 4/4] printk: use the " John Ogness
2020-07-14  5:26   ` [printk] 96d5c61b1f: stress-ng.timerfd.ops_per_sec 8.3% improvement kernel test robot
2020-07-18 12:10   ` [PATCH v5 4/4] printk: use the lockless ringbuffer Marco Elver
2020-07-19  3:43     ` Sergey Senozhatsky
2020-07-20  6:43       ` Marco Elver
2020-07-20  8:22         ` Andy Shevchenko
2020-07-20  8:34         ` Sergey Senozhatsky
2020-07-20  8:41         ` Sergey Senozhatsky
2020-07-20  9:40           ` Marco Elver
2020-07-20 10:01             ` Dmitry Vyukov
2020-07-20 10:20     ` John Ogness
2020-07-20 10:32       ` Marco Elver
2020-08-11 20:47   ` Nick Desaulniers
2020-08-12 16:40     ` John Ogness
2021-01-22 23:52   ` Issue in dmesg time with lockless ring buffer J. Avila
2021-01-25 13:32     ` John Ogness
2021-01-26  0:00       ` J. Avila
2021-01-29  1:46         ` J. Avila
2020-07-10  8:28 ` [PATCH v5 0/4] printk: replace ringbuffer Petr Mladek
2020-07-13  2:23   ` Sergey Senozhatsky

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=20200709132344.760-4-john.ogness@linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=parri.andrea@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).