[igt-dev] [PATCH i-g-t] lib: Incrementally mlock()

Ashutosh Dixit ashutosh.dixit at intel.com
Wed Feb 20 05:39:55 UTC 2019


On Tue, Feb 19 2019 at 09:26:56 PM, Ashutosh Dixit <ashutosh.dixit at intel.com> wrote:
> On Tue, Feb 19 2019 at 03:21:10 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
>> As we already have the previous portion of the mmap mlocked, we only
>> need to mlock() the fresh portion for testing available memory.
>
> Still looking at what is wrong with the patch but with the patch the
> test is unable to lock as much memory as before and invoke the
> shrinker. Here are the outputs before and after the patch on a system
> with 16 GB:

OK, found the bug. The bug is that can_mlock is u64*. Therefore
can_mlock must be cast to u8* on these two lines:


> +     if (mlock(can_mlock + bytes, inc))

and 

> +	igt_assert(!mlock(can_mlock + locked, *can_mlock - locked));

However when we do this, the parent process invariably gets killed by
the OOM killer, something which was not happening previously:

# ./i915_suspend --run-subtest shrink
IGT-Version: 1.23-g9ef791ce (x86_64) (Linux: 5.0.0-rc5+ x86_64)
Starting subtest: shrink
child 0 died with signal 9, Killed
child 0 died with signal 9, Killed
child 0 died with signal 9, Killed
child 0 died with signal 9, Killed
child 0 died with signal 9, Killed
child 0 died with signal 9, Killed
Killed


More information about the igt-dev mailing list