Subject: Re: pthread_create and mlock
To: None <current-users@netbsd.org>
From: Sourath Roy <sourath@gmail.com>
List: current-users
Date: 12/13/2006 19:25:20
------=_Part_187098_12172730.1166018120611
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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?

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
>

------=_Part_187098_12172730.1166018120611
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I got the wired memory limit by dumping vmstat, so that's fine with me.<br>
<br>
I want to add something,<br>
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. <br>
Am I missing something here?<br>
<br>
Can anyone point me to the mlock() implementation? I am running NetBSD on PowerPC.<br>
<br>
Thanks in advance!<br>
<br>
-- Sourath<br><br><div><span class="gmail_quote">On 12/12/06, <b class="gmail_sendername">Sourath Roy</b> &lt;<a href="mailto:sourath@gmail.com">sourath@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
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. <br>
Now the &quot;locked memory&quot; 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()?<br>
<br>
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?<br>
<br>
Thanks in advance!<br><span class="sg">
<br>
-- Sourath<br>

</span></blockquote></div><br>

------=_Part_187098_12172730.1166018120611--