Skip to contentSkip to conversation

sched: remove duplicated init_task's preempt_notifiers init

PATCH Superseded seokhoon.yoon 2 participants 2 messages Aug 16, 2016 – Sep 5, 2016 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: remove duplicated init_task's preempt_notifiers init

init_task's preempt_notifiers is initialized at two times.

1) sched_init()
-> INIT_HLIST_HEAD(&init_task.preempt_notifiers)
2) sched_init()
-> init_idle(current,) <--- current task is init_task at this time

    -> __sched_fork(,current)
     -> INIT_HLIST_HEAD(&p->preempt_notifiers)

I think first one is needless, remove it.

---
 kernel/sched/core.c | 4 ----
 1 file changed, 4 deletions(-)
kernel/sched/core.c +0 -4
index 5c883fe..5760f62 100644
@@ -7482,10 +7482,6 @@ void __init sched_init(void)
 
 	set_load_weight(&init_task);
 
-#ifdef CONFIG_PREEMPT_NOTIFIERS
-	INIT_HLIST_HEAD(&init_task.preempt_notifiers);
-#endif
-
 	/*
 	 * The boot idle thread does lazy MMU switching as well:
 	 */
Signature · 1 line
1.9.1
#1 lore raw

[tip:sched/core] schedcore: Remove duplicated init_task's preempt_notifiers init

schedcore: Remove duplicated init_task's preempt_notifiers init
Commit-ID:  efca03ecbe29a46c2c5ae539563b6326af9dcba7
Gitweb:     http://git.kernel.org/tip/efca03ecbe29a46c2c5ae539563b6326af9dcba7
Author:     seokhoon.yoon <[email protected]>
AuthorDate: Tue, 16 Aug 2016 18:26:08 +0900
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 5 Sep 2016 13:29:44 +0200

schedcore: Remove duplicated init_task's preempt_notifiers init

init_task's preempt_notifiers is initialized twice:

1) sched_init()
-> INIT_HLIST_HEAD(&init_task.preempt_notifiers)

2) sched_init()
-> init_idle(current,) <--- current task is init_task at this time

    -> __sched_fork(,current)
     -> INIT_HLIST_HEAD(&p->preempt_notifiers)

I think the first one is unnecessary, so remove it.

---
 kernel/sched/core.c | 4 ----
 1 file changed, 4 deletions(-)
kernel/sched/core.c +0 -4
index 7d602f5..90b1961 100644
@@ -7554,10 +7554,6 @@ void __init sched_init(void)
 
 	set_load_weight(&init_task);
 
-#ifdef CONFIG_PREEMPT_NOTIFIERS
-	INIT_HLIST_HEAD(&init_task.preempt_notifiers);
-#endif
-
 	/*
 	 * The boot idle thread does lazy MMU switching as well:
 	 */