[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Re: can't mlockall() more than 128MB, is this a kernel limitiation ?
From:       torvalds () transmeta ! com (Linus Torvalds)
Date:       2000-08-06 20:00:05
[Download RAW message or body]

In article <00080616501900.11107@calvin>,
Robert H. de Vries <rhdv@rhdv.cistron.nl> wrote:
>On Sun, 06 Aug 2000, Alan Cox wrote:
>>> IMHO, an ordinary user may only lock a limited amount of memory. Maybe it
>>> is wise to specify a certain amount which may *not* be locked. This memory
>>> is reserved for the rest of the processes.
>>
>>Right now Linux isnt tracking per user resources. You need the beancounter
>>addons to implement per user memory like that
>
>I think Linus has just (test6-pre series) put this facility in the kernel. 
>See the new kernel/user.c.

Yes and no.

The "new" user.c is not actually new at all.  It's the same old "struct
user_struct" that we've had for a long time, and that tracks the number
of processes a specific user has.  You'll find the same "struct
user_struct" in linux-2.2 too - this is much older than the 2.3.x
development tree. 

The new thing is that it's just separated out - it used to be in
kernel/fork.c, and nothing else really knew about it.  But it is
basically the same old code in a new location: kernel/user.c. 

The only _new_ thing in the code is due to "future expansion" changes:
the "struct user_struct" thing has always had a reference counter, and
that reference counter was also used as the "nr of processes using this"
counter: they were one and the same.  For future expansion, I split up
the reference counter and the process counter into two: they should
currently always be the same, but they won't be forever. 

The reason? We can expand it to count more than just processes. And when
we do that, we'll need to have the reference counter be independent of
the things we count.

But no, it's not really new code, just a re-organization of something
we've had for a long time (along with bug-fixes: the stuff in
kernel/sys.c are real fixes for cases that could have caused us to
ignore the process counts completely under low memory circumstances. 
The new code will correctly handle the case of not having enough memory
to create a new virtual user). 

		Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic