On Thursday, May 03, 2012 11:48:48 am cz li wrote:
> I have some questions.As follows ，The kernel address space is how
> much? How it is distributed？ Where can I see?I can adjust it's
> bigger?What should I do if I can？The 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 count
of pages (0 uses the default KSTACK_PAGES).