[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180327073704.GH2236@uranus>
Date: Tue, 27 Mar 2018 10:37:04 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc: willy@...radead.org, yang.shi@...ux.alibaba.com,
adobriyan@...il.com, mhocko@...nel.org, mguzik@...hat.com,
akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and
env_start|end in mm_struct
On Tue, Mar 27, 2018 at 07:00:56AM +0900, Tetsuo Handa wrote:
>
> > To be fair I would prefer to drop this old per-field
> > interface completely. This per-field interface was rather an ugly
> > solution from my side.
>
> But this is userspace visible API and thus we cannot change.
Hi! We could deplrecate this API call for a couple of releases
and then if nobody complain we could rip it off completely.
There should not be many users I think, didn't heard that
someone except criu used it ever.
> > > Then, I wonder whether reading arg_start|end and env_start|end atomically makes
> > > sense. Just retry reading if arg_start > env_end or env_start > env_end is fine?
> >
> > Tetsuo, let me re-read this code tomorrow, maybe I miss something obvious.
> >
>
> You are not missing my point. What I thought is
>
> +retry:
> - down_read(&mm->mmap_sem);
> arg_start = mm->arg_start;
> arg_end = mm->arg_end;
> env_start = mm->env_start;
> env_end = mm->env_end;
> - up_read(&mm->mmap_sem);
>
> - BUG_ON(arg_start > arg_end);
> - BUG_ON(env_start > env_end);
> + if (unlikely(arg_start > arg_end || env_start > env_end)) {
> + cond_resched();
> + goto retry;
> + }
>
> for reading these fields.
I fear such contentional cycles are acceptable if only they
are guaranteed to finish eventually. Which doesn't look so
in the code above.
Cyrill
Powered by blists - more mailing lists