Re: [PATCH 0/3] extend get/setrlimit to support setting rlimitsexternal to a process (v7)

From: Ingo Molnar
Date: Mon Nov 09 2009 - 04:02:13 EST



* Jiri Slaby <jirislaby@xxxxxxxxx> wrote:

> On 11/06/2009 10:26 AM, Ingo Molnar wrote:
> > Also, the locking there looks messy:
> >
> > + /* optimization: 'current' doesn't need locking, e.g. setrlimit */
> > + if (tsk != current) {
> > + /* protect tsk->signal and tsk->sighand from disappearing */
> > + read_lock(&tasklist_lock);
> > + if (!tsk->sighand) {
> > + retval = -ESRCH;
> > + goto out;
> > + }
> > }
> >
> > Neil's splitup into a helper function looks _far_ cleaner.
>
> Oops, I don't understand here. Looking at
> http://patchwork.kernel.org/patch/54863/
> and
> http://decibel.fi.muni.cz/cgi-bin/gitweb.cgi?p=linux.git;a=commitdiff;h=ba9ba971a9241250646091935d77d2f31b7c15af
>
> They are almost identical. That 'if' above is added by:
> http://decibel.fi.muni.cz/cgi-bin/gitweb.cgi?p=linux.git;a=commitdiff;h=bab65b1e6c0fd797a1ecdb32911faa82947effd0
>
> The latter commit is to avoid performance penalty introduced for
> setrlimit syscall by the added lock (as it's unneeded for 'current').
> If you find that crappy, there is no problem to drop it, indeed.

Looks a bit ugly but i agree that it's a real speedup as before this
change we never had to take the tasklist lock for current task rlimit
setting. (which was the only method possible.)

So i guess renaming setrlimit to do_setrlimit and adding the syscall
from Neil's patch should bring the two series into sync, right?

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/