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

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 26 17:42:12 UTC 2019


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


More information about the igt-dev mailing list