From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
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: [PATCH v4 2/3] printk: set may_schedule for some of console_trylock callers
Date: Wed, 17 Feb 2016 00:45:17 +0900 [thread overview]
Message-ID: <20160216154517.GB542@swordfish> (raw)
In-Reply-To: <20160216144306.GU12548@pathway.suse.cz>
On (02/16/16 15:43), Petr Mladek wrote:
> On Sat 2016-02-13 03:37:11, Sergey Senozhatsky wrote:
> > console_unlock() allows to cond_resched() if its caller has
> > set `console_may_schedule' to 1, since
> > 'commit 8d91f8b15361 ("printk: do cond_resched() between lines while
> > outputting to consoles")'.
> >
> > The rules are:
> > -- console_lock() always sets `console_may_schedule' to 1
> > -- console_trylock() always sets `console_may_schedule' to 0
> >
> > However, console_trylock() callers (among them is printk()) do
> > not always call printk() from atomic contexts, and some of them
> > can cond_resched() in console_unlock(), so console_trylock()
> > can set `console_may_schedule' to 1 for such processes.
> >
> > For !CONFIG_PREEMPT_COUNT kernels, however, console_trylock()
> > always sets `console_may_schedule' to 0.
> >
> > It's possible to drop explicit preempt_disable()/preempt_enable()
> > in vprintk_emit(), because console_unlock() and console_trylock()
> > are now smart enough:
> > a) console_unlock() does not cond_resched() when it's unsafe
> > (console_trylock() takes care of that)
> > b) console_unlock() does can_use_console() check.
> >
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
>
> It looks safe after all.
>
> Reviewed-by: Petr Mladek <pmladek@suse.com>
>
thanks.
-ss
next prev parent reply other threads:[~2016-02-16 15:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-12 18:37 [PATCH v4 0/2] let printk()/console_trylock() callers to cond_resched() Sergey Senozhatsky
2016-02-12 18:37 ` [PATCH v4 1/3] printk: move can_use_console out of console_trylock_for_printk Sergey Senozhatsky
2016-02-12 18:37 ` [PATCH v4 2/3] printk: set may_schedule for some of console_trylock callers Sergey Senozhatsky
2016-02-16 14:43 ` Petr Mladek
2016-02-16 15:45 ` Sergey Senozhatsky [this message]
2016-02-12 18:37 ` [PATCH v4 3/3] printk: check CON_ENABLED in have_callable_console() Sergey Senozhatsky
2016-02-16 14:44 ` Petr Mladek
2016-02-16 15:44 ` 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=20160216154517.GB542@swordfish \
--to=sergey.senozhatsky@gmail.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=pmladek@suse.com \
--cc=sergey.senozhatsky.work@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