Messages in this thread Patch in this message | | | Date | Mon, 20 Mar 2006 22:32:34 +0300 | From | Oleg Nesterov <> | Subject | Re: [PATCH] simplify/fix first_tid() |
| |
"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. */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |