tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mmap, ENOMEM and setrlimit



On Wed, May 30, 2012 at 06:40:14AM +0200, Emmanuel Dreyfus wrote:
> Hi
> 
> I am tracking a ENOMEM issue in perfused. It happens in libpuffs's
> callcontext.c:
> 
>         sp = mmap(NULL, stacksize, PROT_READ|PROT_WRITE,
>             MAP_ANON|MAP_PRIVATE|MAP_ALIGNED(pu->pu_cc_stackshift), -1, 0);
> 
> With stacksize = 262144 and pu->pu_cc_stackshift = 18, which looks rather
> reasonable.
> 
> setrlimit is called to set RLIMIT_DATA and RLIMIT_AS soft and hard limit to
> RLIM_INFINITY, hence I am a bit surprised to hit ENOMEM. I must have been
> missing  something. Any hint?
> 
>         rl.rlim_cur = RLIM_INFINITY; 
>         rl.rlim_max = RLIM_INFINITY;

Setting these to unlimited will still leave a kernel limit - possibly
based on the systems physical memory size (even though the amount of
swap would really be relevant).

You probably need to annotate the places where ENOMEM can be set.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index