From: Oleg Nesterov <oleg@redhat.com>
To: Edward Allcutt <edward@allcutt.me.uk>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Randy Dunlap <rdunlap@xenotime.net>,
Andrew Morton <akpm@linux-foundation.org>,
Jiri Kosina <jkosina@suse.cz>,
Dave Young <hidave.darkstar@gmail.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
"H. Peter Anvin" <hpa@zytor.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Neil Horman <nhorman@tuxdriver.com>,
Roland McGrath <roland@redhat.com>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
"Eric W. Biederman" <ebiederm@xmission.com>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: limit maximum concurrent coredumps
Date: Wed, 23 Jun 2010 18:02:21 +0200 [thread overview]
Message-ID: <20100623160221.GA9923@redhat.com> (raw)
In-Reply-To: <20100623155733.GA8874@redhat.com>
On 06/23, Oleg Nesterov wrote:
>
> On 06/21, Edward Allcutt wrote:
> >
> > The ability to limit concurrent coredumps allows dumping core to be safely
> > enabled in these situations without affecting responsiveness of the system
> > as a whole.
>
> OK, but please note that the patch is not right,
OOPS, sorry, I was not exactly right too.
> > @@ -1844,6 +1845,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
> > int retval = 0;
> > int flag = 0;
> > int ispipe;
> > + int dump_count = 0;
> > static atomic_t core_dump_count = ATOMIC_INIT(0);
> > struct coredump_params cprm = {
> > .signr = signr,
> > @@ -1865,6 +1867,14 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
> > if (!__get_dumpable(cprm.mm_flags))
> > goto fail;
> >
> > + dump_count = atomic_inc_return(&core_dump_count);
> > + if (core_max_concurrency && (core_max_concurrency < dump_count)) {
> > + printk(KERN_WARNING "Pid %d(%s) over core_max_concurrency\n",
> > + task_tgid_vnr(current), current->comm);
> > + printk(KERN_WARNING "Skipping core dump\n");
> > + goto fail;
> > + }
> > +
>
> We can't return here. We should kill other threads which share the same
> ->mm in any case.
>
> Suppose that core_dump_count > core_max_concurrency, and we send, say,
> SIGQUIT to the process. With this patch SIGQUIT suddenly starts to kill
> the single thread, this must not happen.
well, the caller does do_group_exit() after do_coredump(), this kills
sub-threads.
However, this doesn't kill other CLONE_VM tasks. Perhaps this is fine,
but I am not sure.
> If you change the patch to sleep until core_dump_count < core_max_concurrency,
> then, again, we should kill other threads first.
Yes, this is true. If we are going to sleep, we shouldn't allow other
threads to run.
Oleg.
prev parent reply other threads:[~2010-06-23 16:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-21 23:58 [PATCH] fs: limit maximum concurrent coredumps Edward Allcutt
2010-06-22 1:23 ` Roland McGrath
2010-06-22 1:41 ` Andrew Morton
2010-06-22 8:49 ` KAMEZAWA Hiroyuki
2010-06-22 3:55 ` H. Peter Anvin
2010-06-22 8:44 ` Jiri Kosina
2010-06-22 8:56 ` Roland McGrath
2010-06-22 2:18 ` KOSAKI Motohiro
2010-06-23 15:57 ` Oleg Nesterov
2010-06-23 16:02 ` Oleg Nesterov [this message]
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=20100623160221.GA9923@redhat.com \
--to=oleg@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=edward@allcutt.me.uk \
--cc=hidave.darkstar@gmail.com \
--cc=hpa@zytor.com \
--cc=jkosina@suse.cz \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nhorman@tuxdriver.com \
--cc=rdunlap@xenotime.net \
--cc=roland@redhat.com \
--cc=schwidefsky@de.ibm.com \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).