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

Caz Yokoyama Caz.Yokoyama at intel.com
Tue Feb 26 20:34:01 UTC 2019


On Tue, 2019-02-26 at 17:42 +0000, Chris Wilson wrote:
> Quoting Yokoyama, Caz (2019-02-26 17:42:51)
> > Chris,
> > I am OK to give "Reviewed by: XXXX" to your patch.
> > However, I want to add following comment/modification which does
> > not
> > affect the effect of your patch.
> > 
> > +                               /*
> > +                                * This is a bug which mlocks far
> > beyond memory,
> > +                                * i.e. there is a hole between 3/4
> > of
> > avail and
> > +                                * (bytes * sizeof(*can_mlock))
> > where
> > +                                * sizeof(*can_mlock)=8. Because of
> > the
> > hole, mlock()
> > +                                * may fail and get out of while
> > loop.
> > +                                * However, We need the hole.
> > Otherwise
> > OOM kills parent
> > +                                * process. Another mlock() below
> > is
> > same.
> > +                                */
> > +                               if (mlock((void *)can_mlock +
> > (bytes *
> > sizeof(*can_mlock)),
> 
> But that's a bug in our code, not mlock(). If we try to mlock more
> memory than is available on the system, quite understandably mlock
> fails.
> 
> So what you are saying here is that you purposely want to not find
> the
> limits of mlockable memory.
> 
> The bug as far as I am concerned was that a subsequent mlock could
> not
> claim the same amount of memory as a previous one -- that feels like
> the
> mm is not reclaiming everything it can after killing the child, or at
> least not making that available again immediately.
> -Chris
Even there was this bug in original code. We have to fix the bug.
However, Fixing the bug makes the test die. I proposed a solution. But
it destroys the purpose of the test. I have no idea how to achieve both
fixing the bug and test porpose.
-caz





More information about the igt-dev mailing list