* per user memory limit and LSM module @ 2009-05-29 12:51 Iliya 2009-05-29 12:57 ` Alan Cox 0 siblings, 1 reply; 3+ messages in thread From: Iliya @ 2009-05-29 12:51 UTC (permalink / raw) To: linux-kernel Hi everyone, I'd like to limit the memory usage per user, using LSM based module. The vm_enough_memory LSM hook is convenient enough , but to make use of it , I would need sum of all the memory usage by the current user. The easiest way I could think of was traversing through all the processes with for_each_process() , checking for the uid and summing up , but this would get too slow when working with more processes. The task_alloc_security/task_free_security LSM hooks are no longer available and maintaining a list of processes per user through the cred_prepare/commit/free will not be accurate and with too much overhead. Any suggestions on how can I quickly get or maintain a list of all the running tasks per user(or just the memory usage), without patching the kernel would be greatly appreciated. Best Regards, Iliya ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: per user memory limit and LSM module 2009-05-29 12:51 per user memory limit and LSM module Iliya @ 2009-05-29 12:57 ` Alan Cox [not found] ` <b0b0b0000905290611r45b1d528o98ee26ec0f534639@mail.gmail.com> 0 siblings, 1 reply; 3+ messages in thread From: Alan Cox @ 2009-05-29 12:57 UTC (permalink / raw) To: Iliya; +Cc: linux-kernel > Any suggestions on how can I quickly get or maintain a list of all the > running tasks per user(or just the memory usage), without patching the > kernel would be greatly appreciated. Even if you could what would you do with it, large parts of memory don't have a single owner and even if they did you would have to traverse tens of thousands of objects so it would be incredibly slow. Take a look at the containers work and OpenVZ as I suspect that is what you need to work from. ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <b0b0b0000905290611r45b1d528o98ee26ec0f534639@mail.gmail.com>]
* Fwd: per user memory limit and LSM module [not found] ` <b0b0b0000905290611r45b1d528o98ee26ec0f534639@mail.gmail.com> @ 2009-05-29 13:15 ` Iliya 0 siblings, 0 replies; 3+ messages in thread From: Iliya @ 2009-05-29 13:15 UTC (permalink / raw) To: linux-kernel ---------- Forwarded message ---------- From: Iliya <vnsavage@gmail.com> Date: Fri, May 29, 2009 at 4:11 PM Subject: Re: per user memory limit and LSM module To: Alan Cox <alan@lxorguk.ukuu.org.uk> On Fri, May 29, 2009 at 3:57 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote: >> Any suggestions on how can I quickly get or maintain a list of all the >> running tasks per user(or just the memory usage), without patching the >> kernel would be greatly appreciated. > > Even if you could what would you do with it, large parts of memory don't > have a single owner and even if they did you would have to traverse tens > of thousands of objects so it would be incredibly slow. Thank you for your reply. If I can quickly sum, let's say the tsk->mm->total_vm (although this would not count the overcommiting) for all tasks owned by a user, I can limit that. What I really need is to make sure that none of the users would eat all the memory or get the system in OOM state. > > Take a look at the containers work and OpenVZ as I suspect that is what > you need to work from. The containers will probably do the job but the module is multi-purpose and I would rather have everything at one place if possible.. > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-05-29 13:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-29 12:51 per user memory limit and LSM module Iliya
2009-05-29 12:57 ` Alan Cox
[not found] ` <b0b0b0000905290611r45b1d528o98ee26ec0f534639@mail.gmail.com>
2009-05-29 13:15 ` Fwd: " Iliya
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®