From: Tejun Heo <tj@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Roland McGrath <roland@hack.frob.com>,
Denys Vlasenko <dvlasenk@redhat.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Matt Fleming <matt.fleming@linux.intel.com>,
linux-kernel@vger.kernel.org, Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH v2 0/3] make vfork killable
Date: Sat, 13 Aug 2011 18:18:14 +0200 [thread overview]
Message-ID: <20110813161814.GE4254@htj.dyndns.org> (raw)
In-Reply-To: <20110812175550.GA7484@redhat.com>
Hello, Oleg.
On Fri, Aug 12, 2011 at 07:55:50PM +0200, Oleg Nesterov wrote:
> > an alternative approach
> > could be handling vfork waiting as a type of job control stop.
>
> Well, I didn't see the code, but to be honest this doesn't look
> like a good idea to me. Firstly, personally I do not think this
> has something to do with the job control stop.
>
> And, to me sys_restart_syscall() looks like the very natural
> approach, and simple.
I've been playing with this and it does a bit further than
implementation simplicity. Currently, we have three different modes
of stopping a task.
* Regular job control and ptrace.
* vfork wait.
* cgroup freeze.
Currently, all three behave differently and the latter two use
UNINTERRUPTIBLE sleep causing rather nasty problems. If we want to
fix the UNINTERRUPTIBLE sleep problem, we end up introducing a new
user visible state no matter which way we go - ie. a task will be in a
state which isn't UNINTERRUPTIBLE sleep but still behave differently
in terms of signal delivery and job control.
What's needed is this different state of being stopped which reponds
to all kernel's desires (killing and ptracing) but stays stopped
regardless of what the user requests.
There's multiple ways to implement this and forced syscall restart is
one way to achieve it - ie. while the stop condition is pending,
syscall is forced to be restarted after interruption and re-enter
stop. The downside is that that wouldn't work with cgroup freeze at
all - there's no syscall to restart.
So, what I'm proposing is to basically add another job control state
which is similar to process group stop but controlled by other
parameters like vfork wait condition or control group frozen state.
This allows these stops to be handled in a way very similar to already
esablished job control states including interaction with ptrace.
> > * When entering get_signal_to_deliver(), if vfork child exists, save
> > sigmask and block all blockable signals.
>
> Oh, I'd like to avoid this. Why should we change get_signal_to_deliver()
> paths to help vfork?
get_signal_to_deliver() may be a misnomer but that's already the place
user tasks go to sleep when they aren't allowed to proceed at the
moment, so it's a logical extension of the existing behavior.
> > * When leaving get_signal_to_deliver(), restore sigmask if saved on
> > entry.
>
> And I _think_ we need much more complications. We still need to
> communicate with the child, for example. Unless we are going to
> add the "struct completion vfork_done" or something into task_struct,
> personally I dislike this idea.
>
> > Haven't really thought a lot about the details so this might end up
> > uglier than the current attempt. :)
>
> I _hope_ it is much uglier, but I can be wrong of course ;)
Oh, it turns out I didn't need this. The implementation isn't simple
tho, but it gives a very uniform behavior across all different modes
of stops. ie. both vfork and freeze under ptrace would report
TRAP_STOP w/ flags indicating stop conditions in effect and would
re-trap if LISTEN is in effect on each state transition, so it can be
handled exactly as the group stop condition.
Thanks.
--
tejun
next prev parent reply other threads:[~2011-08-13 16:18 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-27 16:31 [PATCH 0/8] make vfork killable/restartable/traceable Oleg Nesterov
2011-07-27 16:32 ` [PATCH 1/8] vfork: introduce complete_vfork_done() Oleg Nesterov
2011-07-27 16:32 ` [PATCH 2/8] vfork: introduce clone_vfork_finish() Oleg Nesterov
2011-07-27 16:32 ` [PATCH 3/8] vfork: make it killable Oleg Nesterov
2011-07-29 13:02 ` Matt Fleming
2011-07-29 14:32 ` Oleg Nesterov
2011-07-29 15:32 ` Matt Fleming
2011-07-27 16:33 ` [PATCH 4/8] coredump_wait: don't call complete_vfork_done() Oleg Nesterov
2011-07-29 13:02 ` Matt Fleming
2011-07-29 14:25 ` Oleg Nesterov
2011-07-29 15:26 ` Matt Fleming
2011-07-27 16:33 ` [PATCH 5/8] introduce find_get_task_by_vpid() Oleg Nesterov
2011-07-27 16:33 ` [PATCH 6/8] vfork: do not setup child->vfork_done beforehand Oleg Nesterov
2011-07-27 16:34 ` [PATCH 7/8] vfork: make it stoppable/traceable Oleg Nesterov
2011-07-27 16:34 ` [PATCH 8/8] vfork: do not block SIG_DFL/SIG_IGN signals is single-threaded Oleg Nesterov
2011-07-27 16:34 ` [PATCH 9/8] kill PF_STARTING Oleg Nesterov
2011-07-27 19:39 ` [PATCH 0/8] make vfork killable/restartable/traceable Linus Torvalds
2011-07-28 13:59 ` Oleg Nesterov
2011-07-28 14:58 ` Oleg Nesterov
2011-07-27 22:38 ` Pedro Alves
2011-07-29 19:23 ` Tejun Heo
2011-08-12 17:55 ` [PATCH v2 0/3] make vfork killable Oleg Nesterov
2011-08-12 17:56 ` [PATCH 1/3] vfork: introduce complete_vfork_done() Oleg Nesterov
2011-08-12 17:56 ` [PATCH 2/3] vfork: make it killable Oleg Nesterov
2011-08-19 20:33 ` Matt Fleming
2011-08-22 13:35 ` Oleg Nesterov
2011-08-12 17:56 ` [PATCH 3/3] coredump_wait: don't call complete_vfork_done() Oleg Nesterov
2011-08-17 7:50 ` Tejun Heo
2011-08-17 15:11 ` Oleg Nesterov
2011-08-12 17:57 ` [PATCH 4/3] kill PF_STARTING Oleg Nesterov
2011-08-17 7:51 ` Tejun Heo
2011-08-13 16:18 ` Tejun Heo [this message]
2011-08-15 19:42 ` [PATCH v2 0/3] make vfork killable Oleg Nesterov
2011-08-16 19:42 ` Tejun Heo
2011-08-23 22:01 ` Matt Helsley
2011-08-23 22:12 ` Tejun Heo
[not found] ` <20110727163610.GJ23793@redhat.com>
[not found] ` <20110727175624.GA3950@redhat.com>
[not found] ` <20110728154324.GA22864@redhat.com>
[not found] ` <alpine.DEB.2.00.1107281341060.16093@chino.kir.corp.google.com>
[not found] ` <20110729141431.GA3501@redhat.com>
[not found] ` <20110730143426.GA6061@redhat.com>
2011-07-30 15:22 ` mm->oom_disable_count is broken Oleg Nesterov
2011-08-01 11:52 ` KOSAKI Motohiro
2011-08-29 18:37 ` Oleg Nesterov
2011-08-29 23:17 ` David Rientjes
2011-08-30 7:43 ` [patch 1/2] oom: remove oom_disable_count David Rientjes
2011-08-30 7:43 ` [patch 2/2] oom: fix race while temporarily setting current's oom_score_adj David Rientjes
2011-08-30 15:57 ` Oleg Nesterov
2011-08-30 15:28 ` [patch 1/2] oom: remove oom_disable_count Oleg Nesterov
2011-08-30 22:06 ` David Rientjes
2011-08-30 16:17 ` mm->oom_disable_count is broken Oleg Nesterov
2011-08-10 21:44 ` [PATCH 0/8] make vfork killable/restartable/traceable Pavel Machek
2011-08-11 16:09 ` Oleg Nesterov
2011-08-11 16:22 ` Tejun Heo
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=20110813161814.GE4254@htj.dyndns.org \
--to=tj@kernel.org \
--cc=dvlasenk@redhat.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.fleming@linux.intel.com \
--cc=oleg@redhat.com \
--cc=pavel@ucw.cz \
--cc=roland@hack.frob.com \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®