From: "Jan H. Schönherr" <schnhrr@cs.tu-berlin.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kay Sievers <kay@vrfy.org>
Cc: linux-kernel@vger.kernel.org, "Joe Perches" <joe@perches.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Stephen Rothwell" <sfr@canb.auug.org.au>,
"Jan H. Schönherr" <schnhrr@cs.tu-berlin.de>
Subject: [PATCH v2 06/14] printk: move wake_klogd-check out of the loop
Date: Thu, 6 Dec 2012 18:06:03 +0100 [thread overview]
Message-ID: <1354813571-11253-7-git-send-email-schnhrr@cs.tu-berlin.de> (raw)
In-Reply-To: <1354813571-11253-1-git-send-email-schnhrr@cs.tu-berlin.de>
The checked criterion is loop-independent and we hold the lock necessary
to do the check also outside the loop. So, move that piece of code more
towards the end where the result is used.
Signed-off-by: Jan H. Schönherr <schnhrr@cs.tu-berlin.de>
---
kernel/printk.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/printk.c b/kernel/printk.c
index 7328348..4f3c355 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -2060,10 +2060,6 @@ again:
int level;
raw_spin_lock_irqsave(&logbuf_lock, flags);
- if (seen_seq != log_next_seq) {
- wake_klogd = true;
- seen_seq = log_next_seq;
- }
if (console_seq < log_first_seq) {
/* messages are gone, move to first one */
@@ -2124,6 +2120,10 @@ skip:
*/
raw_spin_lock(&logbuf_lock);
retry = console_seq != log_next_seq;
+ if (seen_seq != log_next_seq) {
+ wake_klogd = true;
+ seen_seq = log_next_seq;
+ }
raw_spin_unlock_irqrestore(&logbuf_lock, flags);
if (retry && console_trylock())
--
1.8.0.1.20.g7c65b2e.dirty
next prev parent reply other threads:[~2012-12-06 17:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-06 17:05 [PATCH v2 00/14] printk() fixes, optimizations, and clean ups Jan H. Schönherr
2012-12-06 17:05 ` [PATCH v2 01/14] printk: drop ambiguous LOG_CONT flag Jan H. Schönherr
2012-12-06 17:05 ` [PATCH v2 02/14] printk: use saved timestamp for temporarily buffered message Jan H. Schönherr
2012-12-06 17:06 ` [PATCH v2 03/14] printk: reclaim cont buffer immediately for fully printed messages Jan H. Schönherr
2012-12-06 17:06 ` [PATCH v2 04/14] printk: do not add unnecessary newlines to the continuation buffer Jan H. Schönherr
2012-12-06 17:06 ` [PATCH v2 05/14] printk: reuse reclaimed continuation buffer immediately Jan H. Schönherr
2012-12-06 17:06 ` Jan H. Schönherr [this message]
2012-12-06 17:06 ` [PATCH v2 07/14] printk: let cont_print_text() reuse existing code Jan H. Schönherr
2012-12-06 17:06 ` [PATCH v2 08/14] printk: refactor locking in console_unlock() Jan H. Schönherr
2012-12-06 17:06 ` [PATCH v2 09/14] printk: retain unknown log-level until cont_add()/log_store() Jan H. Schönherr
2012-12-06 17:06 ` [PATCH v2 10/14] printk: track previously logged message in log_store() Jan H. Schönherr
2012-12-06 17:06 ` [PATCH v2 11/14] printk: avoid glitches in console output Jan H. Schönherr
2012-12-06 17:06 ` [PATCH v2 12/14] printk: encode formatting in message flags Jan H. Schönherr
2012-12-06 17:06 ` [PATCH v2 13/14] printk: drop now useless tracking of previous " Jan H. Schönherr
2012-12-06 17:06 ` [PATCH v2 14/14] printk: refactor continuation buffer handling Jan H. Schönherr
[not found] ` <20121206133907.37c255e9.akpm@linux-foundation.org>
2012-12-06 23:37 ` [PATCH v2 00/14] printk() fixes, optimizations, and clean ups Joe Perches
[not found] ` <20121206161943.78633125.akpm@linux-foundation.org>
2012-12-07 2:51 ` Joe Perches
2012-12-07 11:47 ` "Jan H. Schönherr"
2012-12-07 15:04 ` Greg Kroah-Hartman
2012-12-07 15:42 ` Joe Perches
2012-12-07 15:58 ` Frederic Weisbecker
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=1354813571-11253-7-git-send-email-schnhrr@cs.tu-berlin.de \
--to=schnhrr@cs.tu-berlin.de \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=kay@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/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
all inboxes | Powered by JetHome®