mlock into kernel module
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Chris Wright
Quoted 2 lines · * sej.kernel ([email protected]) wrote:
I need to use mlock and munlock function into a kernel module. How so I call this system call from my module ?
You shouldn't.
Quoted 7 lines
Quoted 2 lines
I need to do this because I must use mlock in my software, but I can't use root or suser to start it. So mlock alwaays fail.
You should be using rlimits for this.
thanks,
-chris
So how to set rlimits ?
My program is in user mode and has to allocate about 128MB to 512MB of non swappable memory. Maybe I can change the rlimits rights into my kernel module ? Do you know how to do this and where to find informations ?
Regards,
sej
Quoted 1 line · * sej ([email protected]) wrote:
So how to set rlimits ?
You have a few options. Considering your program can't run as root, that means directly using setrlimit (or smth like ulimit in bash) is probably not right for you. Take a look at the pam docs for /etc/security/limits.conf, specifically for memlock.
Quoted 3 lines
My program is in user mode and has to allocate about 128MB to 512MB of non swappable memory. Maybe I can change the rlimits rights into my kernel module ?
I have no idea what your kernel module is, nor what your exact requirements are. However, you shouldn't be changing rlimits in a kernel module, there's plenty of userspace support for that.
thanks,
-chris