From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.com>, Tejun Heo <tj@kernel.org>,
Kyle McMartin <kyle@kernel.org>,
Dave Jones <davej@codemonkey.org.uk>,
Calvin Owens <calvinowens@fb.com>,
linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [RFC][PATCH v3 1/4] printk: move can_use_console out of console_trylock_for_printk
Date: Wed, 10 Feb 2016 17:48:16 +0100 [thread overview]
Message-ID: <20160210164816.GG12548@pathway.suse.cz> (raw)
In-Reply-To: <1453536913-9545-2-git-send-email-sergey.senozhatsky@gmail.com>
On Sat 2016-01-23 17:15:10, Sergey Senozhatsky wrote:
> This patch moves can_use_console() check out of
> console_trylock_for_printk(). Instead it calls it in
> console_unlock(), so now console_lock()/console_unlock() are
> also 'protected' by can_use_console().
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
> kernel/printk/printk.c | 86 ++++++++++++++++++++++++--------------------------
> 1 file changed, 42 insertions(+), 44 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 7ebcfea..c39232a 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -1519,21 +1492,7 @@ static inline int can_use_console(unsigned int cpu)
> */
> static int console_trylock_for_printk(void)
> {
> - unsigned int cpu = smp_processor_id();
> -
> - if (!console_trylock())
> - return 0;
> - /*
> - * If we can't use the console, we need to release the console
> - * semaphore by hand to avoid flushing the buffer. We need to hold the
> - * console semaphore in order to do this test safely.
> - */
> - if (!can_use_console(cpu)) {
> - console_locked = 0;
> - up_console_sem();
> - return 0;
> - }
> - return 1;
> + return console_trylock();
> }
I would personally remove console_trylock_for_printk() already in this
patch. I mean to fold the 3rd patch into this one.
> int printk_delay_msec __read_mostly;
> @@ -2247,9 +2233,21 @@ void console_unlock(void)
> do_cond_resched = console_may_schedule;
> console_may_schedule = 0;
>
> +again:
> + /*
> + * We released the console_sem lock, so we need to recheck if
> + * cpu is online and (if not) is there at least one CON_ANYTIME
> + * console.
> + */
> + if (!can_use_console()) {
> + console_locked = 0;
> + up_console_sem();
> + return;
> + }
This is a bug fix and a nice clean up together.
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
next prev parent reply other threads:[~2016-02-10 16:48 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-23 8:15 [RFC][PATCH v3 0/4] let printk()/console_trylock() callers to cond_resched() Sergey Senozhatsky
2016-01-23 8:15 ` [RFC][PATCH v3 1/4] printk: move can_use_console out of console_trylock_for_printk Sergey Senozhatsky
2016-02-10 16:48 ` Petr Mladek [this message]
2016-02-11 7:57 ` Sergey Senozhatsky
2016-01-23 8:15 ` [RFC][PATCH v3 2/4] printk: do not console_cont_flush() on every jump to again Sergey Senozhatsky
2016-02-10 16:58 ` Petr Mladek
2016-02-11 8:03 ` Sergey Senozhatsky
2016-01-23 8:15 ` [RFC][PATCH v3 3/4] printk: remove console_trylock_for_printk Sergey Senozhatsky
2016-02-11 12:33 ` Petr Mladek
2016-01-23 8:15 ` [RFC][PATCH v3 4/4] printk: set may_schedule for some of console_trylock callers Sergey Senozhatsky
2016-02-11 14:41 ` Petr Mladek
2016-02-11 15:02 ` Sergey Senozhatsky
2016-02-11 16:10 ` Petr Mladek
2016-02-12 5:11 ` Sergey Senozhatsky
2016-02-03 3:49 ` [RFC][PATCH v3 0/4] let printk()/console_trylock() callers to cond_resched() 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=20160210164816.GG12548@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=calvinowens@fb.com \
--cc=davej@codemonkey.org.uk \
--cc=jack@suse.com \
--cc=kyle@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=tj@kernel.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
all inboxes | Powered by JetHome®