All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Yang Shi <yang.shi@linux.alibaba.com>,
	adobriyan@gmail.com, willy@infradead.org, mguzik@redhat.com,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [v3 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct
Date: Tue, 10 Apr 2018 13:10:01 +0200	[thread overview]
Message-ID: <20180410111001.GD21835@dhcp22.suse.cz> (raw)
In-Reply-To: <20180410110242.GC2041@uranus.lan>

On Tue 10-04-18 14:02:42, Cyrill Gorcunov wrote:
> On Tue, Apr 10, 2018 at 12:42:15PM +0200, Michal Hocko wrote:
> > 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?
> 
> Because do_brk does vma manipulations, for this reason it's
> running under down_write_killable(&mm->mmap_sem). Or you
> mean something else?

Yes, all we need the new lock for is to get a consistent view on brk
values. I am simply asking whether there is something fundamentally
wrong by doing the update inside the new lock while keeping the original
mmap_sem locking in the brk path. That would allow us to drop the
mmap_sem lock in the proc path when looking at brk values.

-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2018-04-10 11:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-09 21:52 [v3 PATCH] mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct Yang Shi
2018-04-10  8:48 ` Cyrill Gorcunov
2018-04-10  9:09 ` Michal Hocko
2018-04-10  9:40   ` Cyrill Gorcunov
2018-04-10 10:42     ` Michal Hocko
2018-04-10 11:02       ` Cyrill Gorcunov
2018-04-10 11:10         ` Michal Hocko [this message]
2018-04-10 12:28           ` Cyrill Gorcunov
2018-04-10 16:21             ` Yang Shi
2018-04-10 18:28               ` Yang Shi
2018-04-10 18:28                 ` Yang Shi
2018-04-10 19:17                 ` Cyrill Gorcunov
2018-04-10 19:17                   ` Cyrill Gorcunov
2018-04-10 19:33                   ` Yang Shi
2018-04-10 19:33                     ` Yang Shi
2018-04-10 20:06                     ` Cyrill Gorcunov
2018-04-12 12:18                 ` Michal Hocko
2018-04-12 12:18                   ` Michal Hocko
2018-04-12 16:20                   ` Yang Shi
2018-04-12 16:20                     ` Yang Shi
2018-04-13  6:56                     ` Michal Hocko
2018-04-13  6:56                       ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180410111001.GD21835@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mguzik@redhat.com \
    --cc=willy@infradead.org \
    --cc=yang.shi@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.