Skip to contentSkip to conversation

cgroup, cleanup: Delete PF_EXITING checks from cgroup_exit() callbacks

PATCH In review Kirill Tkhai 3 participants 6 messages Aug 31, 2015 – Sep 13, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cgroup, cleanup: Delete PF_EXITING checks from cgroup_exit() callbacks

Remove useless checks and outdates commentaries.

---
 kernel/events/core.c |    8 --------
 kernel/sched/core.c  |    8 --------
 2 files changed, 16 deletions(-)
kernel/events/core.c +0 -8
index ae16867..94bd500 100644
@@ -9219,14 +9219,6 @@ static void perf_cgroup_exit(struct cgroup_subsys_state *css,
 			     struct cgroup_subsys_state *old_css,
 			     struct task_struct *task)
 {
-	/*
-	 * cgroup_exit() is called in the copy_process() failure path.
-	 * Ignore this case since the task hasn't ran yet, this avoids
-	 * trying to poke a half freed task state from generic code.
-	 */
-	if (!(task->flags & PF_EXITING))
-		return;
-
 	task_function_call(task, __perf_cgroup_move, task);
 }
 
kernel/sched/core.c +0 -8
index b3386c6..f8509be 100644
@@ -8167,14 +8167,6 @@ static void cpu_cgroup_exit(struct cgroup_subsys_state *css,
 			    struct cgroup_subsys_state *old_css,
 			    struct task_struct *task)
 {
-	/*
-	 * cgroup_exit() is called in the copy_process() failure path.
-	 * Ignore this case since the task hasn't ran yet, this avoids
-	 * trying to poke a half freed task state from generic code.
-	 */
-	if (!(task->flags & PF_EXITING))
-		return;
-
 	sched_move_task(task);
 }
 
maintainer
#1 lore raw
Quoted 1 line · Kirill Tkhai

Remove useless checks and outdates commentaries.

A slightly bigger Changelog could do, maybe also referring to the commit that made these checks obsolete.

#2 lore raw
Quoted 6 lines · Peter Zijlstra
Quoted 1 line · Kirill Tkhai

Remove useless checks and outdates commentaries.

A slightly bigger Changelog could do, maybe also referring to the commit that made these checks obsolete.

[PATCH] cgroup, cleanup: Delete PF_EXITING checks from cgroup_exit() callbacks

cgroup_exit() is not called from copy_process() after commit e8604cb43690b781:

"cgroup: fix spurious lockdep warning in cgroup_exit()", it's only called

from do_exit(). So these checks are useless and commentaries are obsolete. Remove them.

---
 kernel/events/core.c |    8 --------
 kernel/sched/core.c  |    8 --------
 2 files changed, 16 deletions(-)
kernel/events/core.c +0 -8
index ae16867..94bd500 100644
@@ -9219,14 +9219,6 @@ static void perf_cgroup_exit(struct cgroup_subsys_state *css,
 			     struct cgroup_subsys_state *old_css,
 			     struct task_struct *task)
 {
-	/*
-	 * cgroup_exit() is called in the copy_process() failure path.
-	 * Ignore this case since the task hasn't ran yet, this avoids
-	 * trying to poke a half freed task state from generic code.
-	 */
-	if (!(task->flags & PF_EXITING))
-		return;
-
 	task_function_call(task, __perf_cgroup_move, task);
 }
 
kernel/sched/core.c +0 -8
index b3386c6..f8509be 100644
@@ -8167,14 +8167,6 @@ static void cpu_cgroup_exit(struct cgroup_subsys_state *css,
 			    struct cgroup_subsys_state *old_css,
 			    struct task_struct *task)
 {
-	/*
-	 * cgroup_exit() is called in the copy_process() failure path.
-	 * Ignore this case since the task hasn't ran yet, this avoids
-	 * trying to poke a half freed task state from generic code.
-	 */
-	if (!(task->flags & PF_EXITING))
-		return;
-
 	sched_move_task(task);
 }
 
maintainer
#3 lore raw

I made that two patches, like:

---
Subject: perf: Delete PF_EXITING checks from perf_cgroup_exit() callback
From: Kirill Tkhai <[email protected]>
Date: Mon, 31 Aug 2015 15:12:56 +0300

cgroup_exit() is not called from copy_process() after commit:

e8604cb43690 ("cgroup: fix spurious lockdep warning in cgroup_exit()")

from do_exit(). So this check is useless and the comment is obsolete.

---
 kernel/events/core.c |    8 --------
 1 file changed, 8 deletions(-)
kernel/events/core.c +0 -8
@@ -9219,14 +9219,6 @@ static void perf_cgroup_exit(struct cgro
 			     struct cgroup_subsys_state *old_css,
 			     struct task_struct *task)
 {
-	/*
-	 * cgroup_exit() is called in the copy_process() failure path.
-	 * Ignore this case since the task hasn't ran yet, this avoids
-	 * trying to poke a half freed task state from generic code.
-	 */
-	if (!(task->flags & PF_EXITING))
-		return;
-
 	task_function_call(task, __perf_cgroup_move, task);
 }
 
#4 lore raw

[tip:sched/core] sched/core: Delete PF_EXITING checks from cpu_cgroup_exit() callback

In reply to Kirill Tkhai
sched/core: Delete PF_EXITING checks from cpu_cgroup_exit() callback
Commit-ID:  446685e9bfa11174332fbb0b3218b37015fbf4ff
Gitweb:     http://git.kernel.org/tip/446685e9bfa11174332fbb0b3218b37015fbf4ff
Author:     Kirill Tkhai <[email protected]>
AuthorDate: Mon, 31 Aug 2015 15:12:56 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 13 Sep 2015 09:52:51 +0200

sched/core: Delete PF_EXITING checks from cpu_cgroup_exit() callback

cgroup_exit() is not called from copy_process() after commit:

e8604cb43690 ("cgroup: fix spurious lockdep warning in cgroup_exit()")

from do_exit(). So this check is useless and the comment is obsolete.

---
 kernel/sched/core.c | 8 --------
 1 file changed, 8 deletions(-)
kernel/sched/core.c +0 -8
index 7c099e6..37ab6f9 100644
@@ -8193,14 +8193,6 @@ static void cpu_cgroup_exit(struct cgroup_subsys_state *css,
 			    struct cgroup_subsys_state *old_css,
 			    struct task_struct *task)
 {
-	/*
-	 * cgroup_exit() is called in the copy_process() failure path.
-	 * Ignore this case since the task hasn't ran yet, this avoids
-	 * trying to poke a half freed task state from generic code.
-	 */
-	if (!(task->flags & PF_EXITING))
-		return;
-
 	sched_move_task(task);
 }
 
#5 lore raw

[tip:perf/core] perf/core: Delete PF_EXITING checks from perf_cgroup_exit() callback

In reply to Kirill Tkhai
perf/core: Delete PF_EXITING checks from perf_cgroup_exit() callback
Commit-ID:  516792e67c39d31701641ab355acdb9cbfec0643
Gitweb:     http://git.kernel.org/tip/516792e67c39d31701641ab355acdb9cbfec0643
Author:     Kirill Tkhai <[email protected]>
AuthorDate: Mon, 31 Aug 2015 15:12:56 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 13 Sep 2015 11:27:23 +0200

perf/core: Delete PF_EXITING checks from perf_cgroup_exit() callback

cgroup_exit() is not called from copy_process() after commit:

e8604cb43690 ("cgroup: fix spurious lockdep warning in cgroup_exit()")

from do_exit(). So this check is useless and the comment is obsolete.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Vince Weaver <[email protected]>
---
 kernel/events/core.c | 8 --------
 1 file changed, 8 deletions(-)
kernel/events/core.c +0 -8
index f548f69..76e64be 100644
@@ -9297,14 +9297,6 @@ static void perf_cgroup_exit(struct cgroup_subsys_state *css,
 			     struct cgroup_subsys_state *old_css,
 			     struct task_struct *task)
 {
-	/*
-	 * cgroup_exit() is called in the copy_process() failure path.
-	 * Ignore this case since the task hasn't ran yet, this avoids
-	 * trying to poke a half freed task state from generic code.
-	 */
-	if (!(task->flags & PF_EXITING))
-		return;
-
 	task_function_call(task, __perf_cgroup_move, task);
 }