mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] simplify/fix first_tid()
Date: Mon, 20 Mar 2006 11:56:56 -0700	[thread overview]
Message-ID: <m1y7z5uepz.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <441EF4D7.AEC1AE8C@tv-sign.ru> (Oleg Nesterov's message of "Mon, 20 Mar 2006 21:30:47 +0300")

Oleg Nesterov <oleg@tv-sign.ru> writes:

> "Eric W. Biederman" wrote:
>> This is better however if I read this code correctly.  It modifies
>> the code so the last time user space goes trough this loop
>> with nr > nr_threads.  Then we will walk the entire threads
>> list to achieve nothing.
>
> This can happen only if the thread we stopped at has exited, and
> some other threads have exited too, so that nr >= ->signal->count.
>
> I think it's not worth optimizing this rare and anyway slow path.
> However, you are the code author, I'll send a trivial patch which
> restores this optimization if you don't change you mind.
>
>> 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.

Eric

  reply	other threads:[~2006-03-20 18:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-19 19:25 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 [this message]
2006-03-20 19:32       ` Oleg Nesterov

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=m1y7z5uepz.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    /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®