* [PATCH 0/1] (Was: freezer: add missing mb's to freezer_count() and freezer_should_skip())
[not found] ` <20121024185710.GA12182@atj.dyndns.org>
@ 2012-10-25 16:39 ` Oleg Nesterov
2012-10-25 16:39 ` [PATCH 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule() Oleg Nesterov
0 siblings, 1 reply; 16+ messages in thread
From: Oleg Nesterov @ 2012-10-25 16:39 UTC (permalink / raw)
To: Tejun Heo; +Cc: rjw, linux-kernel, lizefan, containers, cgroups, stable
Hi Tejun,
On 10/24, Tejun Heo wrote:
> Hello, Oleg.
>
> On Tue, Oct 23, 2012 at 05:39:19PM +0200, Oleg Nesterov wrote:
> > > Hmm.... Guess we should drop __ from set_current_state.
> >
> > Yes.
> >
> > Or we can change ptrace_stop() and do_signal_stop() to use freezer_do_not_count/
> > freezer_count and remove task_is_stopped_or_traced() from update_if_frozen()
> > and try_to_freeze_tasks(). But this means that do_signal_stop() will call
> > try_to_freeze() twice, unless we add __freezer_count() which only clears
> > PF_FREEZER_SKIP.
>
> Ooh, I like this idea. If we have a mechanism to mark a task "frozen
> enough", it makes sense to use it universally.
Yes, I agree.
Fortunately we already have freezable_schedule() so this patch is
really simple.
On top of this series.
Oleg.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-25 16:39 ` [PATCH 0/1] (Was: freezer: add missing mb's to freezer_count() and freezer_should_skip()) Oleg Nesterov
@ 2012-10-25 16:39 ` Oleg Nesterov
2012-10-25 17:18 ` Tejun Heo
0 siblings, 1 reply; 16+ messages in thread
From: Oleg Nesterov @ 2012-10-25 16:39 UTC (permalink / raw)
To: Tejun Heo; +Cc: rjw, linux-kernel, lizefan, containers, cgroups, stable
Change ptrace_stop() and do_signal_stop() to use freezable_schedule()
rather than rely on subsequent try_to_freeze().
This allows to remove the task_is_stopped_or_traced() checks from
try_to_freeze_tasks() and update_if_frozen(), and this fixes the
unlikely race with ptrace_stop(). If the tracee does not schedule()
it can miss a freezing condition.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
include/linux/freezer.h | 7 +++----
kernel/cgroup_freezer.c | 3 +--
kernel/freezer.c | 11 ++---------
kernel/power/process.c | 13 +------------
kernel/signal.c | 11 ++---------
5 files changed, 9 insertions(+), 36 deletions(-)
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index ee89932..8039893 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -134,10 +134,9 @@ static inline bool freezer_should_skip(struct task_struct *p)
}
/*
- * These macros are intended to be used whenever you want allow a task that's
- * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note
- * that neither return any clear indication of whether a freeze event happened
- * while in this function.
+ * These macros are intended to be used whenever you want allow a sleeping
+ * task to be frozen. Note that neither return any clear indication of
+ * whether a freeze event happened while in this function.
*/
/* Like schedule(), but should not block the freezer. */
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
index 8a92b0e..bedefd9 100644
--- a/kernel/cgroup_freezer.c
+++ b/kernel/cgroup_freezer.c
@@ -198,8 +198,7 @@ static void update_if_frozen(struct cgroup *cgroup, struct freezer *freezer)
* completion. Consider it frozen in addition to
* the usual frozen condition.
*/
- if (!frozen(task) && !task_is_stopped_or_traced(task) &&
- !freezer_should_skip(task))
+ if (!frozen(task) && !freezer_should_skip(task))
goto notyet;
}
}
diff --git a/kernel/freezer.c b/kernel/freezer.c
index 11f82a4..c38893b 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -116,17 +116,10 @@ bool freeze_task(struct task_struct *p)
return false;
}
- if (!(p->flags & PF_KTHREAD)) {
+ if (!(p->flags & PF_KTHREAD))
fake_signal_wake_up(p);
- /*
- * fake_signal_wake_up() goes through p's scheduler
- * lock and guarantees that TASK_STOPPED/TRACED ->
- * TASK_RUNNING transition can't race with task state
- * testing in try_to_freeze_tasks().
- */
- } else {
+ else
wake_up_state(p, TASK_INTERRUPTIBLE);
- }
spin_unlock_irqrestore(&freezer_lock, flags);
return true;
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 87da817..d5a258b 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -48,18 +48,7 @@ static int try_to_freeze_tasks(bool user_only)
if (p == current || !freeze_task(p))
continue;
- /*
- * Now that we've done set_freeze_flag, don't
- * perturb a task in TASK_STOPPED or TASK_TRACED.
- * It is "frozen enough". If the task does wake
- * up, it will immediately call try_to_freeze.
- *
- * Because freeze_task() goes through p's scheduler lock, it's
- * guaranteed that TASK_STOPPED/TRACED -> TASK_RUNNING
- * transition can't race with task state testing here.
- */
- if (!task_is_stopped_or_traced(p) &&
- !freezer_should_skip(p))
+ if (!freezer_should_skip(p))
todo++;
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
diff --git a/kernel/signal.c b/kernel/signal.c
index 0af8868..1660d7d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1908,7 +1908,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
preempt_disable();
read_unlock(&tasklist_lock);
preempt_enable_no_resched();
- schedule();
+ freezable_schedule();
} else {
/*
* By the time we got the lock, our tracer went away.
@@ -1930,13 +1930,6 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
}
/*
- * While in TASK_TRACED, we were considered "frozen enough".
- * Now that we woke up, it's crucial if we're supposed to be
- * frozen that we freeze now before running anything substantial.
- */
- try_to_freeze();
-
- /*
* We are back. Now reacquire the siglock before touching
* last_siginfo, so that we are sure to have synchronized with
* any signal-sending on another CPU that wants to examine it.
@@ -2092,7 +2085,7 @@ static bool do_signal_stop(int signr)
}
/* Now we don't run again until woken by SIGCONT or SIGKILL */
- schedule();
+ freezable_schedule();
return true;
} else {
/*
--
1.5.5.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-25 16:39 ` [PATCH 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule() Oleg Nesterov
@ 2012-10-25 17:18 ` Tejun Heo
2012-10-25 17:34 ` Oleg Nesterov
0 siblings, 1 reply; 16+ messages in thread
From: Tejun Heo @ 2012-10-25 17:18 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: rjw, linux-kernel, lizefan, containers, cgroups, stable
Hello, Oleg.
On Thu, Oct 25, 2012 at 06:39:59PM +0200, Oleg Nesterov wrote:
> Change ptrace_stop() and do_signal_stop() to use freezable_schedule()
> rather than rely on subsequent try_to_freeze().
>
> This allows to remove the task_is_stopped_or_traced() checks from
> try_to_freeze_tasks() and update_if_frozen(), and this fixes the
> unlikely race with ptrace_stop(). If the tracee does not schedule()
> it can miss a freezing condition.
I think it would be great if the description is more detailed. This
code path always makes my head spin and I think we can definitely use
some more guiding in understanding this dang thing. :)
> @@ -48,18 +48,7 @@ static int try_to_freeze_tasks(bool user_only)
> if (p == current || !freeze_task(p))
> continue;
>
> - /*
> - * Now that we've done set_freeze_flag, don't
> - * perturb a task in TASK_STOPPED or TASK_TRACED.
> - * It is "frozen enough". If the task does wake
> - * up, it will immediately call try_to_freeze.
> - *
> - * Because freeze_task() goes through p's scheduler lock, it's
> - * guaranteed that TASK_STOPPED/TRACED -> TASK_RUNNING
> - * transition can't race with task state testing here.
> - */
> - if (!task_is_stopped_or_traced(p) &&
> - !freezer_should_skip(p))
> + if (!freezer_should_skip(p))
> todo++;
> } while_each_thread(g, p);
> read_unlock(&tasklist_lock);
This looks really good.
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 0af8868..1660d7d 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1908,7 +1908,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
> preempt_disable();
> read_unlock(&tasklist_lock);
> preempt_enable_no_resched();
> - schedule();
> + freezable_schedule();
> } else {
> /*
> * By the time we got the lock, our tracer went away.
> @@ -1930,13 +1930,6 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
> }
>
> /*
> - * While in TASK_TRACED, we were considered "frozen enough".
> - * Now that we woke up, it's crucial if we're supposed to be
> - * frozen that we freeze now before running anything substantial.
> - */
> - try_to_freeze();
> -
> - /*
> * We are back. Now reacquire the siglock before touching
> * last_siginfo, so that we are sure to have synchronized with
> * any signal-sending on another CPU that wants to examine it.
> @@ -2092,7 +2085,7 @@ static bool do_signal_stop(int signr)
> }
>
> /* Now we don't run again until woken by SIGCONT or SIGKILL */
> - schedule();
> + freezable_schedule();
This makes me wonder whether we still need try_to_freeze() in
get_signal_to_deliver() right after the relock: label. Freezer no
longer treats STOPPED/TRACED special and both sleeping sites in signal
deliver path are marked freezable_schedule(). We shouldn't need the
explicit try_to_freeze(), right?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-25 17:18 ` Tejun Heo
@ 2012-10-25 17:34 ` Oleg Nesterov
2012-10-25 17:36 ` Tejun Heo
0 siblings, 1 reply; 16+ messages in thread
From: Oleg Nesterov @ 2012-10-25 17:34 UTC (permalink / raw)
To: Tejun Heo; +Cc: rjw, linux-kernel, lizefan, containers, cgroups, stable
On 10/25, Tejun Heo wrote:
>
> Hello, Oleg.
>
> On Thu, Oct 25, 2012 at 06:39:59PM +0200, Oleg Nesterov wrote:
> > Change ptrace_stop() and do_signal_stop() to use freezable_schedule()
> > rather than rely on subsequent try_to_freeze().
> >
> > This allows to remove the task_is_stopped_or_traced() checks from
> > try_to_freeze_tasks() and update_if_frozen(), and this fixes the
> > unlikely race with ptrace_stop(). If the tracee does not schedule()
> > it can miss a freezing condition.
>
> I think it would be great if the description is more detailed. This
> code path always makes my head spin and I think we can definitely use
> some more guiding in understanding this dang thing. :)
Do you mean describe the race in more details? OK, will do and resend
tomorrow.
> > @@ -2092,7 +2085,7 @@ static bool do_signal_stop(int signr)
> > }
> >
> > /* Now we don't run again until woken by SIGCONT or SIGKILL */
> > - schedule();
> > + freezable_schedule();
>
> This makes me wonder whether we still need try_to_freeze() in
> get_signal_to_deliver() right after the relock: label. Freezer no
> longer treats STOPPED/TRACED special and both sleeping sites in signal
> deliver path are marked freezable_schedule(). We shouldn't need the
> explicit try_to_freeze(), right?
OOPS.
I'd say this doesn't really matter but yes we can move it up,
get_signal_to_deliver() will be called again.
But! the comment above try_to_freeze() becomes misleading with
this patch, so this really needs v2.
Thanks.
Oleg.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-25 17:34 ` Oleg Nesterov
@ 2012-10-25 17:36 ` Tejun Heo
2012-10-26 17:45 ` [PATCH v2 0/1] " Oleg Nesterov
0 siblings, 1 reply; 16+ messages in thread
From: Tejun Heo @ 2012-10-25 17:36 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: rjw, linux-kernel, lizefan, containers, cgroups, stable
Hello,
On Thu, Oct 25, 2012 at 07:34:33PM +0200, Oleg Nesterov wrote:
> > I think it would be great if the description is more detailed. This
> > code path always makes my head spin and I think we can definitely use
> > some more guiding in understanding this dang thing. :)
>
> Do you mean describe the race in more details? OK, will do and resend
> tomorrow.
Yeah and maybe explain briefly how schedule_freezable() gets us out of
the trouble.
> > > @@ -2092,7 +2085,7 @@ static bool do_signal_stop(int signr)
> > > }
> > >
> > > /* Now we don't run again until woken by SIGCONT or SIGKILL */
> > > - schedule();
> > > + freezable_schedule();
> >
> > This makes me wonder whether we still need try_to_freeze() in
> > get_signal_to_deliver() right after the relock: label. Freezer no
> > longer treats STOPPED/TRACED special and both sleeping sites in signal
> > deliver path are marked freezable_schedule(). We shouldn't need the
> > explicit try_to_freeze(), right?
>
> OOPS.
>
> I'd say this doesn't really matter but yes we can move it up,
> get_signal_to_deliver() will be called again.
Right, we can't remove it. That's our main freezing point for
userland tasks.
> But! the comment above try_to_freeze() becomes misleading with
> this patch, so this really needs v2.
But, yeah, I think we should move it above relock: and update the
comment to explain that that's the usual freezing site.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 0/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-25 17:36 ` Tejun Heo
@ 2012-10-26 17:45 ` Oleg Nesterov
2012-10-26 17:46 ` [PATCH v2 1/1] " Oleg Nesterov
0 siblings, 1 reply; 16+ messages in thread
From: Oleg Nesterov @ 2012-10-26 17:45 UTC (permalink / raw)
To: Tejun Heo; +Cc: rjw, linux-kernel, lizefan, containers, cgroups, stable
Hi Tejun,
On 10/25, Tejun Heo wrote:
>
> > But! the comment above try_to_freeze() becomes misleading with
> > this patch, so this really needs v2.
>
> But, yeah, I think we should move it above relock: and update the
> comment to explain that that's the usual freezing site.
Yeeeeeeees, I knew that you won't allow me to simply remove the old
comment without adding the new one ;)
And you can't imagine how many time I spent trying to invent something
meaningful. Please feel free to update/rewrite it, I am not sure it
is good enough. Or I can send v3 if you suggest something better.
Oleg.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-26 17:45 ` [PATCH v2 0/1] " Oleg Nesterov
@ 2012-10-26 17:46 ` Oleg Nesterov
2012-10-26 17:52 ` Tejun Heo
2012-10-27 22:22 ` Ben Hutchings
0 siblings, 2 replies; 16+ messages in thread
From: Oleg Nesterov @ 2012-10-26 17:46 UTC (permalink / raw)
To: Tejun Heo; +Cc: rjw, linux-kernel, lizefan, containers, cgroups, stable
try_to_freeze_tasks() and cgroup_freezer rely on scheduler locks
to ensure that a task doing STOPPED/TRACED -> RUNNING transition
can't escape freezing. This mostly works, but ptrace_stop() does
not necessarily call schedule(), it can change task->state back to
RUNNING and check freezing() without any lock/barrier in between.
We could add the necessary barrier, but this patch changes
ptrace_stop() and do_signal_stop() to use freezable_schedule().
This fixes the race, freezer_count() and freezer_should_skip()
carefully avoid the race.
And this simplifies the code, try_to_freeze_tasks/update_if_frozen
no longer need to use task_is_stopped_or_traced() checks with the
non trivial assumptions. We can rely on the mechanism which was
specially designed to mark the sleeping task as "frozen enough".
v2: As Tejun pointed out, we can also change get_signal_to_deliver()
and move try_to_freeze() up before 'relock' label.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
include/linux/freezer.h | 7 +++----
kernel/cgroup_freezer.c | 3 +--
kernel/freezer.c | 11 ++---------
kernel/power/process.c | 13 +------------
kernel/signal.c | 20 ++++++--------------
5 files changed, 13 insertions(+), 41 deletions(-)
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index ee89932..8039893 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -134,10 +134,9 @@ static inline bool freezer_should_skip(struct task_struct *p)
}
/*
- * These macros are intended to be used whenever you want allow a task that's
- * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note
- * that neither return any clear indication of whether a freeze event happened
- * while in this function.
+ * These macros are intended to be used whenever you want allow a sleeping
+ * task to be frozen. Note that neither return any clear indication of
+ * whether a freeze event happened while in this function.
*/
/* Like schedule(), but should not block the freezer. */
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c
index 8a92b0e..bedefd9 100644
--- a/kernel/cgroup_freezer.c
+++ b/kernel/cgroup_freezer.c
@@ -198,8 +198,7 @@ static void update_if_frozen(struct cgroup *cgroup, struct freezer *freezer)
* completion. Consider it frozen in addition to
* the usual frozen condition.
*/
- if (!frozen(task) && !task_is_stopped_or_traced(task) &&
- !freezer_should_skip(task))
+ if (!frozen(task) && !freezer_should_skip(task))
goto notyet;
}
}
diff --git a/kernel/freezer.c b/kernel/freezer.c
index 11f82a4..c38893b 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -116,17 +116,10 @@ bool freeze_task(struct task_struct *p)
return false;
}
- if (!(p->flags & PF_KTHREAD)) {
+ if (!(p->flags & PF_KTHREAD))
fake_signal_wake_up(p);
- /*
- * fake_signal_wake_up() goes through p's scheduler
- * lock and guarantees that TASK_STOPPED/TRACED ->
- * TASK_RUNNING transition can't race with task state
- * testing in try_to_freeze_tasks().
- */
- } else {
+ else
wake_up_state(p, TASK_INTERRUPTIBLE);
- }
spin_unlock_irqrestore(&freezer_lock, flags);
return true;
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 87da817..d5a258b 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -48,18 +48,7 @@ static int try_to_freeze_tasks(bool user_only)
if (p == current || !freeze_task(p))
continue;
- /*
- * Now that we've done set_freeze_flag, don't
- * perturb a task in TASK_STOPPED or TASK_TRACED.
- * It is "frozen enough". If the task does wake
- * up, it will immediately call try_to_freeze.
- *
- * Because freeze_task() goes through p's scheduler lock, it's
- * guaranteed that TASK_STOPPED/TRACED -> TASK_RUNNING
- * transition can't race with task state testing here.
- */
- if (!task_is_stopped_or_traced(p) &&
- !freezer_should_skip(p))
+ if (!freezer_should_skip(p))
todo++;
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
diff --git a/kernel/signal.c b/kernel/signal.c
index 0af8868..5ffb562 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1908,7 +1908,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
preempt_disable();
read_unlock(&tasklist_lock);
preempt_enable_no_resched();
- schedule();
+ freezable_schedule();
} else {
/*
* By the time we got the lock, our tracer went away.
@@ -1930,13 +1930,6 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
}
/*
- * While in TASK_TRACED, we were considered "frozen enough".
- * Now that we woke up, it's crucial if we're supposed to be
- * frozen that we freeze now before running anything substantial.
- */
- try_to_freeze();
-
- /*
* We are back. Now reacquire the siglock before touching
* last_siginfo, so that we are sure to have synchronized with
* any signal-sending on another CPU that wants to examine it.
@@ -2092,7 +2085,7 @@ static bool do_signal_stop(int signr)
}
/* Now we don't run again until woken by SIGCONT or SIGKILL */
- schedule();
+ freezable_schedule();
return true;
} else {
/*
@@ -2200,15 +2193,14 @@ int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
if (unlikely(uprobe_deny_signal()))
return 0;
-relock:
/*
- * We'll jump back here after any time we were stopped in TASK_STOPPED.
- * While in TASK_STOPPED, we were considered "frozen enough".
- * Now that we woke up, it's crucial if we're supposed to be
- * frozen that we freeze now before running anything substantial.
+ * Do this once, we can't return to user-mode if freezing() == T.
+ * do_signal_stop() and ptrace_stop() do freezable_schedule() and
+ * thus do not need another check after return.
*/
try_to_freeze();
+relock:
spin_lock_irq(&sighand->siglock);
/*
* Every stopped thread goes here after wakeup. Check to see if
--
1.5.5.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-26 17:46 ` [PATCH v2 1/1] " Oleg Nesterov
@ 2012-10-26 17:52 ` Tejun Heo
2012-10-26 18:01 ` Oleg Nesterov
2012-10-27 22:22 ` Ben Hutchings
1 sibling, 1 reply; 16+ messages in thread
From: Tejun Heo @ 2012-10-26 17:52 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: rjw, linux-kernel, lizefan, containers, cgroups, stable
On Fri, Oct 26, 2012 at 07:46:06PM +0200, Oleg Nesterov wrote:
> try_to_freeze_tasks() and cgroup_freezer rely on scheduler locks
> to ensure that a task doing STOPPED/TRACED -> RUNNING transition
> can't escape freezing. This mostly works, but ptrace_stop() does
> not necessarily call schedule(), it can change task->state back to
> RUNNING and check freezing() without any lock/barrier in between.
>
> We could add the necessary barrier, but this patch changes
> ptrace_stop() and do_signal_stop() to use freezable_schedule().
> This fixes the race, freezer_count() and freezer_should_skip()
> carefully avoid the race.
>
> And this simplifies the code, try_to_freeze_tasks/update_if_frozen
> no longer need to use task_is_stopped_or_traced() checks with the
> non trivial assumptions. We can rely on the mechanism which was
> specially designed to mark the sleeping task as "frozen enough".
>
> v2: As Tejun pointed out, we can also change get_signal_to_deliver()
> and move try_to_freeze() up before 'relock' label.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Looks good to me. :)
Acked-by: Tejun Heo <tj@kernel.org>
Rafael, sorry that this one doesn't have pm cc'd but can you please
pick up this one too?
Thanks a lot.
--
tejun
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-26 17:52 ` Tejun Heo
@ 2012-10-26 18:01 ` Oleg Nesterov
2012-10-26 21:14 ` Rafael J. Wysocki
0 siblings, 1 reply; 16+ messages in thread
From: Oleg Nesterov @ 2012-10-26 18:01 UTC (permalink / raw)
To: Tejun Heo; +Cc: rjw, linux-kernel, lizefan, containers, cgroups, stable
On 10/26, Tejun Heo wrote:
>
> Acked-by: Tejun Heo <tj@kernel.org>
Thanks!
> Rafael, sorry that this one doesn't have pm cc'd
Ah, sorry Rafael. Yes, I have read you email, and I was going to
add linux-pm but forgot.
> but can you please
> pick up this one too?
Please, and thanks.
Oleg.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-26 18:01 ` Oleg Nesterov
@ 2012-10-26 21:14 ` Rafael J. Wysocki
2012-10-26 21:29 ` Rafael J. Wysocki
0 siblings, 1 reply; 16+ messages in thread
From: Rafael J. Wysocki @ 2012-10-26 21:14 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Tejun Heo, linux-kernel, lizefan, containers, cgroups, stable
On Friday, October 26, 2012 08:01:49 PM Oleg Nesterov wrote:
> On 10/26, Tejun Heo wrote:
> >
> > Acked-by: Tejun Heo <tj@kernel.org>
>
> Thanks!
>
> > Rafael, sorry that this one doesn't have pm cc'd
>
> Ah, sorry Rafael. Yes, I have read you email, and I was going to
> add linux-pm but forgot.
>
> > but can you please
> > pick up this one too?
>
> Please, and thanks.
OK, but that will go to Linus in the next batch.
Thanks,
Rafael
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-26 21:29 ` Rafael J. Wysocki
@ 2012-10-26 21:29 ` Tejun Heo
2012-10-28 0:16 ` Rafael J. Wysocki
0 siblings, 1 reply; 16+ messages in thread
From: Tejun Heo @ 2012-10-26 21:29 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Oleg Nesterov, linux-kernel, lizefan, containers, cgroups, stable
Hello,
On Fri, Oct 26, 2012 at 11:29:56PM +0200, Rafael J. Wysocki wrote:
> Actually, what tree is it supposed to apply to?
>
> The change in kernel/cgroup_freezer.c doesn't look like anything in
> the current Linus' tree to me.
Ooh, right. This depends on the earlier cgroup_freezer changes.
Sorry about the confusion. I'll apply it to the following branch (the
same one used for the previous cgroup_freezer updates).
git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git cgroup-freezer
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-26 21:14 ` Rafael J. Wysocki
@ 2012-10-26 21:29 ` Rafael J. Wysocki
2012-10-26 21:29 ` Tejun Heo
0 siblings, 1 reply; 16+ messages in thread
From: Rafael J. Wysocki @ 2012-10-26 21:29 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Tejun Heo, linux-kernel, lizefan, containers, cgroups, stable
On Friday, October 26, 2012 11:14:17 PM Rafael J. Wysocki wrote:
> On Friday, October 26, 2012 08:01:49 PM Oleg Nesterov wrote:
> > On 10/26, Tejun Heo wrote:
> > >
> > > Acked-by: Tejun Heo <tj@kernel.org>
> >
> > Thanks!
> >
> > > Rafael, sorry that this one doesn't have pm cc'd
> >
> > Ah, sorry Rafael. Yes, I have read you email, and I was going to
> > add linux-pm but forgot.
> >
> > > but can you please
> > > pick up this one too?
> >
> > Please, and thanks.
>
> OK, but that will go to Linus in the next batch.
Actually, what tree is it supposed to apply to?
The change in kernel/cgroup_freezer.c doesn't look like anything in
the current Linus' tree to me.
Thanks,
Rafael
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-26 17:46 ` [PATCH v2 1/1] " Oleg Nesterov
2012-10-26 17:52 ` Tejun Heo
@ 2012-10-27 22:22 ` Ben Hutchings
2012-10-28 13:45 ` Oleg Nesterov
1 sibling, 1 reply; 16+ messages in thread
From: Ben Hutchings @ 2012-10-27 22:22 UTC (permalink / raw)
To: Oleg Nesterov
Cc: Tejun Heo, rjw, linux-kernel, lizefan, containers, cgroups,
stable
[-- Attachment #1: Type: text/plain, Size: 1317 bytes --]
On Fri, 2012-10-26 at 19:46 +0200, Oleg Nesterov wrote:
> try_to_freeze_tasks() and cgroup_freezer rely on scheduler locks
> to ensure that a task doing STOPPED/TRACED -> RUNNING transition
> can't escape freezing. This mostly works, but ptrace_stop() does
> not necessarily call schedule(), it can change task->state back to
> RUNNING and check freezing() without any lock/barrier in between.
>
> We could add the necessary barrier, but this patch changes
> ptrace_stop() and do_signal_stop() to use freezable_schedule().
> This fixes the race, freezer_count() and freezer_should_skip()
> carefully avoid the race.
>
> And this simplifies the code, try_to_freeze_tasks/update_if_frozen
> no longer need to use task_is_stopped_or_traced() checks with the
> non trivial assumptions. We can rely on the mechanism which was
> specially designed to mark the sleeping task as "frozen enough".
>
> v2: As Tejun pointed out, we can also change get_signal_to_deliver()
> and move try_to_freeze() up before 'relock' label.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
[...]
This is not the correct way to submit a change to stable. Please see
Documentation/stable_kernel_rules.txt
Ben.
--
Ben Hutchings
Never attribute to conspiracy what can adequately be explained by stupidity.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-26 21:29 ` Tejun Heo
@ 2012-10-28 0:16 ` Rafael J. Wysocki
0 siblings, 0 replies; 16+ messages in thread
From: Rafael J. Wysocki @ 2012-10-28 0:16 UTC (permalink / raw)
To: Tejun Heo
Cc: Oleg Nesterov, linux-kernel, lizefan, containers, cgroups, stable
On Friday, October 26, 2012 02:29:09 PM Tejun Heo wrote:
> Hello,
>
> On Fri, Oct 26, 2012 at 11:29:56PM +0200, Rafael J. Wysocki wrote:
> > Actually, what tree is it supposed to apply to?
> >
> > The change in kernel/cgroup_freezer.c doesn't look like anything in
> > the current Linus' tree to me.
>
> Ooh, right. This depends on the earlier cgroup_freezer changes.
> Sorry about the confusion. I'll apply it to the following branch (the
> same one used for the previous cgroup_freezer updates).
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git cgroup-freezer
OK
I haven't merged it yet, so I'll get this fix along with the rest.
Thanks,
Rafael
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule()
2012-10-27 22:22 ` Ben Hutchings
@ 2012-10-28 13:45 ` Oleg Nesterov
0 siblings, 0 replies; 16+ messages in thread
From: Oleg Nesterov @ 2012-10-28 13:45 UTC (permalink / raw)
To: Ben Hutchings
Cc: Tejun Heo, rjw, linux-kernel, lizefan, containers, cgroups,
stable
On 10/27, Ben Hutchings wrote:
>
> On Fri, 2012-10-26 at 19:46 +0200, Oleg Nesterov wrote:
> > try_to_freeze_tasks() and cgroup_freezer rely on scheduler locks
> > to ensure that a task doing STOPPED/TRACED -> RUNNING transition
> > can't escape freezing. This mostly works, but ptrace_stop() does
> > not necessarily call schedule(), it can change task->state back to
> > RUNNING and check freezing() without any lock/barrier in between.
> >
> > We could add the necessary barrier, but this patch changes
> > ptrace_stop() and do_signal_stop() to use freezable_schedule().
> > This fixes the race, freezer_count() and freezer_should_skip()
> > carefully avoid the race.
> >
> > And this simplifies the code, try_to_freeze_tasks/update_if_frozen
> > no longer need to use task_is_stopped_or_traced() checks with the
> > non trivial assumptions. We can rely on the mechanism which was
> > specially designed to mark the sleeping task as "frozen enough".
> >
> > v2: As Tejun pointed out, we can also change get_signal_to_deliver()
> > and move try_to_freeze() up before 'relock' label.
> >
> > Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> [...]
>
> This is not the correct way to submit a change to stable. Please see
> Documentation/stable_kernel_rules.txt
Sorry for confusion, it is not for stable@, it was cc'ed by mistake.
Oleg.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] cgroup: remove unused dummy cgroup_fork_callbacks()
[not found] ` <20121220052533.GA17190@herton-Z68MA-D2H-B3>
@ 2012-12-28 21:22 ` Tejun Heo
0 siblings, 0 replies; 16+ messages in thread
From: Tejun Heo @ 2012-12-28 21:22 UTC (permalink / raw)
To: Herton Ronaldo Krzesinski
Cc: rjw, oleg, linux-kernel, lizefan, containers, cgroups, stable
>From a0a4bddd2779a51b6529afa113c5671ebcc21b14 Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Fri, 28 Dec 2012 13:18:28 -0800
5edee61ede ("cgroup: cgroup_subsys->fork() should be called after the
task is added to css_set") removed cgroup_fork_callbacks() but forgot
to remove its dummy version for !CONFIG_CGROUPS. Remove it.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
Applied to cgroup/for-3.9. Thanks.
include/linux/cgroup.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 7d73905..942e687 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -706,7 +706,6 @@ struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
static inline int cgroup_init_early(void) { return 0; }
static inline int cgroup_init(void) { return 0; }
static inline void cgroup_fork(struct task_struct *p) {}
-static inline void cgroup_fork_callbacks(struct task_struct *p) {}
static inline void cgroup_post_fork(struct task_struct *p) {}
static inline void cgroup_exit(struct task_struct *p, int callbacks) {}
--
1.8.0.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2012-12-28 21:22 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1350426526-14254-1-git-send-email-tj@kernel.org>
[not found] ` <1350426526-14254-3-git-send-email-tj@kernel.org>
[not found] ` <20121022174404.GA21553@redhat.com>
[not found] ` <20121022211317.GD5951@atj.dyndns.org>
[not found] ` <20121023153919.GA16201@redhat.com>
[not found] ` <20121024185710.GA12182@atj.dyndns.org>
2012-10-25 16:39 ` [PATCH 0/1] (Was: freezer: add missing mb's to freezer_count() and freezer_should_skip()) Oleg Nesterov
2012-10-25 16:39 ` [PATCH 1/1] freezer: change ptrace_stop/do_signal_stop to use freezable_schedule() Oleg Nesterov
2012-10-25 17:18 ` Tejun Heo
2012-10-25 17:34 ` Oleg Nesterov
2012-10-25 17:36 ` Tejun Heo
2012-10-26 17:45 ` [PATCH v2 0/1] " Oleg Nesterov
2012-10-26 17:46 ` [PATCH v2 1/1] " Oleg Nesterov
2012-10-26 17:52 ` Tejun Heo
2012-10-26 18:01 ` Oleg Nesterov
2012-10-26 21:14 ` Rafael J. Wysocki
2012-10-26 21:29 ` Rafael J. Wysocki
2012-10-26 21:29 ` Tejun Heo
2012-10-28 0:16 ` Rafael J. Wysocki
2012-10-27 22:22 ` Ben Hutchings
2012-10-28 13:45 ` Oleg Nesterov
[not found] ` <1350426526-14254-2-git-send-email-tj@kernel.org>
[not found] ` <20121220052533.GA17190@herton-Z68MA-D2H-B3>
2012-12-28 21:22 ` [PATCH] cgroup: remove unused dummy cgroup_fork_callbacks() Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).