From: cfme_admin <cfme_admin@163.com>
To: "peterz@infradead.org" <peterz@infradead.org>,
"mingo@redhat.com" <mingo@redhat.com>, 我 <cfme_admin@163.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re:[PATCH] sched: fix BUG in preempt_notifier
Date: Wed, 1 Jul 2015 15:16:06 +0800 (CST) [thread overview]
Message-ID: <1206dcd9.10422.14e48790026.Coremail.cfme_admin@163.com> (raw)
In-Reply-To: <1435732410-18060-1-git-send-email-cfme_admin@163.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 3076 bytes --]
more information about the bug is below:
https://bugzilla.kernel.org/show_bug.cgi?id=100701
the preempt_notifier_unregister function is run in_atomic context, but static_key_slow_dec function may cause sleep.
At 2015-07-01 14:33:30, "Lidong Chen" <cfme_admin@163.com> wrote:
>Signed-off-by: Lidong Chen <cfme_admin@163.com>
>---
> kernel/sched/core.c | 25 ++++---------------------
> 1 file changed, 4 insertions(+), 21 deletions(-)
>
>diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>index b803e1b..4a5a964 100644
>--- a/kernel/sched/core.c
>+++ b/kernel/sched/core.c
>@@ -2318,15 +2318,12 @@ void wake_up_new_task(struct task_struct *p)
>
> #ifdef CONFIG_PREEMPT_NOTIFIERS
>
>-static struct static_key preempt_notifier_key = STATIC_KEY_INIT_FALSE;
>-
> /**
> * preempt_notifier_register - tell me when current is being preempted & rescheduled
> * @notifier: notifier struct to register
> */
> void preempt_notifier_register(struct preempt_notifier *notifier)
> {
>- static_key_slow_inc(&preempt_notifier_key);
> hlist_add_head(¬ifier->link, ¤t->preempt_notifiers);
> }
> EXPORT_SYMBOL_GPL(preempt_notifier_register);
>@@ -2340,11 +2337,10 @@ EXPORT_SYMBOL_GPL(preempt_notifier_register);
> void preempt_notifier_unregister(struct preempt_notifier *notifier)
> {
> hlist_del(¬ifier->link);
>- static_key_slow_dec(&preempt_notifier_key);
> }
> EXPORT_SYMBOL_GPL(preempt_notifier_unregister);
>
>-static void __fire_sched_in_preempt_notifiers(struct task_struct *curr)
>+static void fire_sched_in_preempt_notifiers(struct task_struct *curr)
> {
> struct preempt_notifier *notifier;
>
>@@ -2352,14 +2348,9 @@ static void __fire_sched_in_preempt_notifiers(struct task_struct *curr)
> notifier->ops->sched_in(notifier, raw_smp_processor_id());
> }
>
>-static __always_inline void fire_sched_in_preempt_notifiers(struct task_struct *curr)
>-{
>- if (static_key_false(&preempt_notifier_key))
>- __fire_sched_in_preempt_notifiers(curr);
>-}
>
> static void
>-__fire_sched_out_preempt_notifiers(struct task_struct *curr,
>+fire_sched_out_preempt_notifiers(struct task_struct *curr,
> struct task_struct *next)
> {
> struct preempt_notifier *notifier;
>@@ -2368,21 +2359,13 @@ __fire_sched_out_preempt_notifiers(struct task_struct *curr,
> notifier->ops->sched_out(notifier, next);
> }
>
>-static __always_inline void
>-fire_sched_out_preempt_notifiers(struct task_struct *curr,
>- struct task_struct *next)
>-{
>- if (static_key_false(&preempt_notifier_key))
>- __fire_sched_out_preempt_notifiers(curr, next);
>-}
>-
> #else /* !CONFIG_PREEMPT_NOTIFIERS */
>
>-static inline void fire_sched_in_preempt_notifiers(struct task_struct *curr)
>+static void fire_sched_in_preempt_notifiers(struct task_struct *curr)
> {
> }
>
>-static inline void
>+static void
> fire_sched_out_preempt_notifiers(struct task_struct *curr,
> struct task_struct *next)
> {
>--
>2.1.0
>
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2015-07-01 7:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-01 6:33 [PATCH] " Lidong Chen
2015-07-01 7:16 ` cfme_admin [this message]
2015-07-01 7:23 ` Ingo Molnar
2015-07-01 7:41 ` Wanpeng Li
2015-07-02 0:38 ` cfme_admin
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=1206dcd9.10422.14e48790026.Coremail.cfme_admin@163.com \
--to=cfme_admin@163.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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
Powered by JetHome