Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751602AbbGAGeQ (ORCPT ); Wed, 1 Jul 2015 02:34:16 -0400 Received: from m12-11.163.com ([220.181.12.11]:54415 "EHLO m12-11.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157AbbGAGeK (ORCPT ); Wed, 1 Jul 2015 02:34:10 -0400 From: Lidong Chen To: mingo@redhat.com, peterz@infradead.org Cc: linux-kernel@vger.kernel.org, Lidong Chen Subject: [PATCH] sched: fix BUG in preempt_notifier Date: Wed, 1 Jul 2015 14:33:30 +0800 Message-Id: <1435732410-18060-1-git-send-email-cfme_admin@163.com> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: C8CowEDpJk+7iZNVvUVkCg--.642S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxGF47Zw4xKF18AF17KF43GFg_yoW5XFyDpa s8G397ua1Dta4jga1aqr48AFy3KFyxW3s7J34kGayrt3WktrsrJFWUZry3JFWrWry09F1f Jw4vgr47Zw18Jw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j-jjDUUUUU= X-Originating-IP: [59.38.97.70] X-CM-SenderInfo: 5fipvspdgpx0i6rwjhhfrp/xtbBzx4qd1D+nM71QwAAsG Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2801 Lines: 87 Signed-off-by: Lidong Chen --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/