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

From: Michal Hocko
Date: Tue Apr 10 2018 - 06:42:22 EST


On Tue 10-04-18 12:40:47, Cyrill Gorcunov wrote:
> On Tue, Apr 10, 2018 at 11:09:17AM +0200, Michal Hocko wrote:
> > On Tue 10-04-18 05:52:54, Yang Shi wrote:
> > [...]
> > > So, introduce a new spinlock in mm_struct to protect the concurrent
> > > access to arg_start|end, env_start|end and others except start_brk and
> > > brk, which are still protected by mmap_sem to avoid concurrent access
> > > from do_brk().
> >
> > Is there any fundamental problem with brk using the same lock?
>
> Seems so. Look into mm/mmap.c:brk syscall which reads and writes
> brk value under mmap_sem ('cause of do_brk called inside).

Why cannot we simply use the lock when the value is updated?

--
Michal Hocko
SUSE Labs