public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Denys Vlasenko <vda.linux@googlemail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org
Subject: Does process need to have a kernel-side stack all the time?
Date: Mon, 14 Apr 2008 15:47:57 +0200	[thread overview]
Message-ID: <200804141547.57719.vda.linux@googlemail.com> (raw)

Hi Ingo,

You are one of the experts in processes/threads and scheduling
in Linux kernel, I hope you can answer this question.

A lot of effort went into minimizing of stack usage.
If I understand it correctly, one of the reasons for this
was to be efficient and not have lots of pages
used for stacks when we have a lot of threads
(tens of thousands).

A random thought occurred to me: in a system with so many
threads most of them are not executing anyway, even on
that gigantic Altix machines. Do they all need to have
kernel stack, all the time? I mean: the process which
is running in user space is not using kernel stack at all.
Process which is not running on a CPU right now
is not using it either. But they do still consume
at least 4k (or 8k on 64bits) of RAM.

Process absolutely must have kernel stack only when
it is actively running in kernel code (not sleeping),
right?

Can we have per-CPU kernel stacks instead, so that process
gets a kernel stack only every time it enters the kernel;
and make it so that the process which is scheduled away
from a CPU does not need to have kernel stack?

Currently, when process sleeps, we save some
state in stack, and such a change may require
some substantial surgery.

Can you tell me whether this is possible at all,
and how difficult you estimate it to be?
--
vda

             reply	other threads:[~2008-04-14 13:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-14 13:47 Denys Vlasenko [this message]
2008-04-14 14:17 ` Does process need to have a kernel-side stack all the time? Denis V. Lunev
2008-04-14 14:54   ` Denys Vlasenko
2008-04-14 15:21     ` Ingo Molnar
2008-04-14 17:44 ` Andi Kleen
2008-04-14 18:42   ` Denys Vlasenko
2008-04-16 12:47   ` Ingo Molnar
2008-04-16 13:02     ` Andi Kleen
2008-04-16 13:54     ` Arjan van de Ven
2008-04-16 13:59       ` Andi Kleen
2008-04-16 14:31         ` Arjan van de Ven
2008-04-16 14:20     ` Denys Vlasenko
2008-04-16 14:34       ` Arjan van de Ven
2008-04-14 23:21 ` Chris Snook

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=200804141547.57719.vda.linux@googlemail.com \
    --to=vda.linux@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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