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

Caz Yokoyama Caz.Yokoyama at intel.com
Wed Feb 20 22:28:37 UTC 2019


Yes, it is a bug.

With the bug, mlocking is sparsely distributed, i.e. there are holes
between mlocked memories. Therefore, process is not killed.

By fixing the bug, continuously mlocked as planned and killed.

My test shows OOM kills a process when a process mlocks 128mb less than
pinnable memory while not when less than 256mb.

I'll send a patch where
- intel_get_total_pinnable_mem() reports pinnable memory
- test_shrink() mlocks X(>128, <256)mb
-caz

On Tue, 2019-02-19 at 21:39 -0800, Ashutosh Dixit wrote:
> 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
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev



More information about the igt-dev mailing list