[LTP] [PATCH 3/4] syscalls/mlock201: Add new testcase

Xiao Yang yangx.jy@cn.fujitsu.com
Thu Aug 30 03:17:22 CEST 2018


On 2018/08/29 20:42, Jan Stancek wrote:
> ----- Original Message -----
>> ----- Original Message -----
>>> Check the basic functionality of mlock2(2) since kernel v2.6.9.
> Missed this one:
>    mlock2() is available since Linux 4.4.
Hi Jan,

Thanks for your review.

It seems that mlock2() has been backported by some distros(e.g. 
RHEL7.6), so i use tst_syscall()
instead of .min_kver to check if mlock2() is supported.

 From mlock2() manpage:
Before Linux 2.6.8, a process must be privileged (CAP_IPC_LOCK) in order 
to lock memory and the
RLIMIT_MEMLOCK soft resource limit defines a limit on how much memory 
the process may lock.
Since Linux 2.6.9, no limits are placed on the amount of memory that a 
privileged process can lock
and the RLIMIT_MEMLOCK soft resource limit instead defines a limit on 
how  much memory an unprivileged\
process may lock.

I just check the behavior of mlock2() since Linux 2.6.9.
>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>>> + * Description:
>>> + * Check the basic functionality of the mlock2(2) since kernel v2.6.9:
>>> + * 1) Use mlock2(2) without MLOCK_ONFAULT to lock memory in the specified
>>> + *    range that is multiples of page size or not, and the VmLck from
>>> + *    /proc/PID/status shows correct size of memory that is locked by PID.
>>> + * 2) Use mlock2(2) with MLOCK_ONFAULT to lock memory in the specified
>>> + *    range that is multiples of page size or not, and the VmLck from
>>> + *    /proc/PID/status show correct size of memory that is locked by PID.
>> Can we also check if MLOCK_ONFAULT doesn't make non-present pages present,
>> but it still locks present pages? (mincore(2) or /proc/pid/pagemap)
I will try to check this point as you suggested.

Thanks,
Xiao Yang
>> Regards,
>> Jan
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
>>
>
>





More information about the ltp mailing list