Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 May 2012 08:14:52 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        cz li <willingbug@gmail.com>
Subject:   Re: The user-mode stack space is how many bytes?
Message-ID:  <201205040814.52668.jhb@freebsd.org>
In-Reply-To: <CAMSkA6qv8UNCWDrLpLKObL9p7Z_1jTZ2iDCdQ=4E99qtJw%2B4eA@mail.gmail.com>
References:  <CAMSkA6r34oAkbT1wVMjJ_V02TMnUuq1tkNjR8anagBpgMxkUdw@mail.gmail.com> <CAMSkA6qv8UNCWDrLpLKObL9p7Z_1jTZ2iDCdQ=4E99qtJw%2B4eA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, May 03, 2012 11:48:48 am cz li wrote:
> I have some questions.As follows =EF=BC=8CThe kernel address space is how
> much? How it is distributed=EF=BC=9F Where can I see?I can adjust it's
> bigger?What should I do if I can=EF=BC=9FThe change will make some
> applications can not run?
> Sorry, my English is poor. I'm looking forward to your reply. Thank you.

The default kernel stack size is set by KSTACK_PAGES in <machine/param.h>
(e.g. sys/amd64/include/param.h).  Note that the size in bytes is
KSTACK_PAGES * PAGE_SIZE.  You can make it bigger for all threads by making
that larger and building a new kernel.  However, this will increase the
amount of wired memory in your running system reducing the amount of RAM
available for other things.  Applications should generally not care about
the size of the kernel stack, though if you make it really large it may be
that you will no longer have sufficient RAM for an application with a large
number of threads.  On 32-bit platforms like i386 you may very well run out
of kernel virtual address space before you run out of RAM.

Alternatively, if you just want to use a larger kernel stack for a specific
kernel thread you are creating, you can do that by setting the 'pages'
parameter to kproc_create(), kproc_kthread_add(), or kthread_add() to a cou=
nt
of pages (0 uses the default KSTACK_PAGES).

=2D-=20
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205040814.52668.jhb>