Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct

From: Cyrill Gorcunov
Date: Tue Mar 27 2018 - 03:38:43 EST


On Mon, Mar 26, 2018 at 06:12:55PM -0400, Yang Shi wrote:
> > + if (unlikely(arg_start > arg_end || env_start > env_end)) {
> > + cond_resched();
> > + goto retry;
>
> Can't it trap into dead loop if the condition is always false?

Yes, unfortunately it can.

> > + }
> >
> > for reading these fields.
> >
> > By the way, /proc/pid/ readers are serving as a canary who tells something
> > mm_mmap related problem is happening. On the other hand, it is sad that
> > such canary cannot be terminated by signal due to use of unkillable waits.
> > I wish we can use killable waits.
>
> I already proposed patches (https://lkml.org/lkml/2018/2/26/1197) to do this
> a few weeks ago. In the review, akpm suggested mitigate the mmap_sem
> contention instead of using killable version workaround. Then the
> preliminary unmaping by section patches
> (https://lkml.org/lkml/2018/3/20/786) were proposed. In the discussion, we
> decided to eliminate the mmap_sem abuse, this is where the patch came from.