From: Philippe Gerum <rpm@xenomai.org>
To: Andreas Glatz <andreasglatz@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Running out of stack memory in kernel-space
Date: Fri, 29 May 2009 00:14:45 +0200 [thread overview]
Message-ID: <1243548885.22173.62.camel@domain.hid> (raw)
In-Reply-To: <1243534987.898.44.camel@domain.hid>
On Thu, 2009-05-28 at 14:23 -0400, Andreas Glatz wrote:
> On Thu, 2009-05-28 at 18:39 +0200, Philippe Gerum wrote:
> > On Thu, 2009-05-28 at 11:59 -0400, Andreas Glatz wrote:
> > > Hi,
> > >
> > > We have to start 40+ Xenomai tasks in kernel space.
> > > We want to allocate at least 4kbyte of stack memory
> > > for each of them. So we need the stack heap size
> > > to be more than 160kbyte.
> > >
> > > In the documentation it says that the total
> > > stack heap size cannot be more than 128kbyte
> > > (the limit of kmalloc).
> >
> > Could you point me at that doc? TIA,
> >
> > >
> > > Now my idea is to modify the Xenomai code to have
> > > more than one stack heaps. So when I'm running out
> > > of space in one heap I can switch to the next heap...
> > >
> > > Is there an easier way to increase the max. stack heap size?
> > >
> >
> > See CONFIG_XENO_OPT_SYS_STACKPOOLSZ, nucleus configuration menu.
>
> I found this in kernel/xenomai/nucleus/Kconfig :
>
> config XENO_OPT_SYS_STACKPOOLSZ
> depends on XENO_GENERIC_STACKPOOL
> int "Size of the private stack pool (Kb)"
> default 32
> range 0 128
> help
>
> On this architecture, kernel-based Xenomai threads get the
> stack space they need from a private memory pool. If you
> don't start any kernel-based thread (i.e. no RTDM driver
> thread, and no real-time task created from an application
> embodied into a kernel module), you may leave a zero value for
> this option. The size is expressed in Kilobytes.
>
Ok, you must be running a Xenomai release prior to 2.4.7 where this
useless limitation was lifted. I would really, really, really, really,
indeed, I mean, no kidding, I swear, life will be good after this,
recommend (*) that you upgrade to 2.4.8 when it is available.
For the time being, you could just get rid of the 128k limit with that
patch:
--- ksrc/nucleus/Kconfig~ 2008-11-09 18:54:04.000000000 +0100
+++ ksrc/nucleus/Kconfig 2009-05-29 00:10:05.000000000 +0200
@@ -145,7 +145,6 @@
depends on XENO_GENERIC_STACKPOOL
int "Size of the private stack pool (Kb)"
default 32
- range 0 128
help
On this architecture, kernel-based Xenomai threads get the
(*) no, seriously.
>
> And if you follow the CONFIG_XENO_OPT_SYS_STACKPOOLSZ macro
> you eventually end up at this comment in kernel/xenomai/nucleus/pod.c :
>
> /*
> * We have to differentiate the system heap memory from the
> * pool the kernel thread stacks will be obtained from,
> * because on some architectures, vmalloc memory may not be
> * accessed while running in physical addressing mode
> * (e.g. exception trampoline code on powerpc with standard
> * MMU support - CONFIG_PPC_STD_MMU). Meanwhile, since we want
> * to allow the system heap to be larger than 128Kb in
> * contiguous memory, we can't restrict to using kmalloc()
> * memory for it either. Therefore, we manage a private stack
> * pool for kernel-based threads which will be populated with
> * the kind of memory the underlying arch requires, still
> * allowing the system heap to rely on a vmalloc'ed segment.
> */
> heapaddr = xnarch_alloc_stack_mem(CONFIG_XENO_OPT_SYS_STACKPOOLSZ *
> 1024);
I will fix this leftover in 2.4.8, thanks.
>
>
>
> Andreas
>
--
Philippe.
next prev parent reply other threads:[~2009-05-28 22:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-28 15:59 [Xenomai-help] Running out of stack memory in kernel-space Andreas Glatz
2009-05-28 16:39 ` Philippe Gerum
2009-05-28 18:23 ` Andreas Glatz
2009-05-28 22:14 ` Philippe Gerum [this message]
2009-05-28 16:52 ` Philippe Gerum
2009-05-28 17:58 ` Andreas Glatz
2009-05-28 21:47 ` Philippe Gerum
2009-06-22 13:23 ` Andreas Glatz
2009-06-23 9:30 ` Philippe Gerum
2009-06-23 9:37 ` Gilles Chanteperdrix
2009-06-23 10:23 ` Philippe Gerum
2009-06-23 10:37 ` Philippe Gerum
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=1243548885.22173.62.camel@domain.hid \
--to=rpm@xenomai.org \
--cc=andreasglatz@domain.hid \
--cc=xenomai@xenomai.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.