Subject: Re: pthread_create and mlock
To: Sourath Roy <sourath@gmail.com>
From: Jason Thorpe <thorpej@shagadelic.org>
List: current-users
Date: 12/14/2006 13:43:44
On Dec 13, 2006, at 5:55 AM, Sourath Roy wrote:

> I got the wired memory limit by dumping vmstat, so that's fine with  
> me.
>
> I want to add something,
> pthread_create() does a mlock() but I don't see anything in the  
> libpthread that would suggest that memory is unlocked using  
> munlock(). I understand the logic of reusability, but what if there  
> are large number of threads spawned at a time and then the process  
> has only few threads. In that case, it would still be locking more  
> memory than what it practically should do.
> Am I missing something here?

When it is unmapped, it will be implicitly unlocked.

>
>
> Can anyone point me to the mlock() implementation? I am running  
> NetBSD on PowerPC.
>
> Thanks in advance!
>
> -- Sourath
>
> On 12/12/06, Sourath Roy <sourath@gmail.com> wrote:
> Hi,
> While running my application on NetBSD, I often see a problem where  
> pthread_create() returns EAGAIN. Looking through the  
> pthread_create() function implementation it appeared to me that the  
> mlock() fails.
> Now the "locked memory" limit on my system is high enough for the  
> pthread_create() to fail on that. Is it truly the mlock failure, or  
> there is some known issues with pthread_create()?
>
> Also, when I try to change the per process MEMLOCK limit to higher  
> than the system default, I don't see any real increase. Is it  
> limited by the wired memory? Is there a system call on NetBSD that  
> would tell me the wired memory on the system?
>
> Thanks in advance!
>
> -- Sourath
>

-- thorpej