mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>,
	pj@sgi.com, saito.tadashi@soft.fujitsu.com,
	Andi Kleen <ak@suse.de>
Subject: Re: [RFC][PATCH] ps command race fix take2 [1/4] list token
Date: Tue, 22 Aug 2006 10:56:08 -0600	[thread overview]
Message-ID: <m164gkr9p3.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20060822173904.5f8f6e0f.kamezawa.hiroyu@jp.fujitsu.com> (KAMEZAWA Hiroyuki's message of "Tue, 22 Aug 2006 17:39:04 +0900")

KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> writes:

> This is ps command race fix take2. Unfortunately, against 2.6.18-rc4.
> I'll rebase this to appropriate kernel if O.K. (I think this is RFC)
>
> This patch implements Paul Jackson's idea, 'inserting false link in task list'.

Currently the tasklist_lock is one of the more highly contended locks in
the kernel.  Adding an extra place it is taken is undesirable.
If could see a better algorithm for sending a signal to all processes
in a process groups we could remove the tasklist_lock entirely.

In addition you only solves half the readdir problems.  You don't solve
the seek problem which is returning to an offset you had been to
before.  A relatively rare case but...

> Good point of this approach is cost of searching task is O(N) (N=num of tgids).
> Bad point is lock and kmalloc/kfree.
> I didin't modified thread_list and cpuset's proc list, maybe future work.
>
> If searching pid bitmap is better, please take Erics.

My patch at least needs a good changelog but I believe it will work
better and can be further improved with a better pid data structure
if there is actually a problem there.  Given that I don't take
any locks it should be much friendlier at scale, and the code
was simpler.

However I will miss a few newly forked processes and I don't think your
technique will miss any.  Still neither will miss a process that
existed the entire time.

If nothing else I think it was worth posting so we could contrast the two.

Eric

  parent reply	other threads:[~2006-08-22 16:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-22  8:39 KAMEZAWA Hiroyuki
2006-08-22 11:06 ` Andi Kleen
2006-08-22 11:23   ` KAMEZAWA Hiroyuki
2006-08-22 16:56 ` Eric W. Biederman [this message]
2006-08-22 22:22   ` KAMEZAWA Hiroyuki
2006-08-23  6:11     ` Eric W. Biederman
2006-08-23  8:33       ` KAMEZAWA Hiroyuki
2006-08-23 11:35         ` Eric W. Biederman
2006-08-23 12:46           ` KAMEZAWA Hiroyuki
2006-08-23  9:55       ` Avi Kivity
2006-08-23 12:12         ` Eric W. Biederman

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=m164gkr9p3.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pj@sgi.com \
    --cc=saito.tadashi@soft.fujitsu.com \
    /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

Powered by JetHome