From: Oleg Nesterov <oleg@tv-sign.ru>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] simplify/fix first_tid()
Date: Mon, 20 Mar 2006 22:32:34 +0300 [thread overview]
Message-ID: <441F0352.758F0321@tv-sign.ru> (raw)
In-Reply-To: m1y7z5uepz.fsf@ebiederm.dsl.xmission.com
"Eric W. Biederman" wrote:
>
> Oleg Nesterov <oleg@tv-sign.ru> writes:
>
> >> So we really still need the nr_threads test in there so we don't
> >> traverse the list twice everytime through readdir.
> >
> > How so? We don't do it twice?
>
> In general user space does. Because a read of 0 bytes signifies
> the end of a directory.
>
> So we have 2 trips through proc_task_readdir initiated by user
> space.
Oh, thanks, you are right.
[PATCH] simplify-fix-first_tid-fix
Restore a stupidly deleted optimization.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- MM/fs/proc/base.c~ 2006-03-21 01:08:10.000000000 +0300
+++ MM/fs/proc/base.c 2006-03-21 01:14:36.000000000 +0300
@@ -2190,6 +2190,11 @@ static struct task_struct *first_tid(str
goto found;
}
+ /* If nr exceeds the number of threads there is nothing todo */
+ pos = NULL;
+ if (nr && nr >= get_nr_threads(leader))
+ goto out;
+
/* If we haven't found our starting place yet start
* with the leader and walk nr threads forward.
*/
prev parent reply other threads:[~2006-03-20 19:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-19 19:25 [PATCH] simplify/fix first_tid() Oleg Nesterov
2006-03-20 18:00 ` Eric W. Biederman
2006-03-20 18:30 ` Oleg Nesterov
2006-03-20 18:56 ` Eric W. Biederman
2006-03-20 19:32 ` 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=441F0352.758F0321@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@osdl.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.