The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: [patch] kwaitd, 2.5.31-A1
Date: Tue, 13 Aug 2002 10:35:43 -0700	[thread overview]
Message-ID: <3D59436F.3DFAFA36@zip.com.au> (raw)
In-Reply-To: Pine.LNX.4.44.0208131755090.31234-100000@localhost.localdomain

Ingo Molnar wrote:
> 
> ...
> the reaping of the thread is thus not done by the parent (or init), but by
> per-CPU [kwaitd] kernel threads. The exiting thread queues itself always
> to the CPU-local kwaitd queue, to maintain locality of reference and cheap
> switching to kwaitd.

I'd be inclined to agree with hch on that.  We have an awful lot of
kernel threads nowadays, and keventd would fill the bill.

Andrea's kernels have keventd running SCHED_RR, and that's appropriate
to this application also.   Not sure about AIO though.

> [ this new reaping method could also be used when reparenting to init -
> but i'm unsure whether this would really work as expected - do some init
> variants rely perhaps on getting all orphan tasks in the system? ]

That should be OK.  init never knew about the reparented ones anyway.

> ...
> +
> +static kwait_t kwait_threads[NR_CPUS] __cacheline_aligned;
> +

We need to start using Rusty's percpu stuff sometime.

> +void reap_thread(task_t *p)
> +{
> +       kwait_t *kwait = kwait_threads + smp_processor_id();
> +

get_cpu() here?

> +
> +       if (p->parent == kwait->task) {
> +               printk("hm, %s(%d) reaped already.\n", p->comm, p->pid);
> +               return;
> +       }
> +       REMOVE_LINKS(p);

This is called under read_lock(&tasklist_lock), but modifies the
task list.

> ...
> +
> +                       schedule();
> +                       current->state = TASK_RUNNING;

schedule() always returns in state TASK_RUNNING?  (Or at least, it
used to.  Tell me if that changed, quick ;))

And a question: is it not possible to make the exitting task just go
and reap itself?  If it's a matter of freeing the stack pages we could
just add the page to a per-cpu deferred freeing list and reap it in
page reclaim.

  parent reply	other threads:[~2002-08-13 17:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-13 16:01 [patch] kwaitd, 2.5.31-A1 Ingo Molnar
2002-08-13 16:16 ` Christoph Hellwig
2002-08-13 17:35 ` Andrew Morton [this message]
2002-08-13 17:37   ` Ingo Molnar
2002-08-13 18:05     ` Andrew Morton
2002-08-13 17:59       ` Ingo Molnar
2002-08-13 18:58       ` [patch] clone-detached-2.5.31-A1 Ingo Molnar
2002-08-13 19:44         ` Ingo Molnar
2002-08-13 17:42   ` [patch] kwaitd, 2.5.31-A1 Ingo Molnar

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=3D59436F.3DFAFA36@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.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