linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: "Kirill A. Shutemov" <kirill@shutemov.name>,
	Yang Shi <yang.shi@linux.alibaba.com>
Cc: mhocko@kernel.org, willy@infradead.org,
	ldufour@linux.vnet.ibm.com, akpm@linux-foundation.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [v2 PATCH 2/2 -mm] mm: brk: dwongrade mmap_sem to read when shrinking
Date: Thu, 27 Sep 2018 15:21:09 +0200	[thread overview]
Message-ID: <3ba966a4-abf9-1363-3e82-41fe73bc0919@suse.cz> (raw)
In-Reply-To: <20180927125025.xnvoh2btdq5kjmai@kshutemo-mobl1>

On 9/27/18 2:50 PM, Kirill A. Shutemov wrote:
>> diff --git a/mm/mmap.c b/mm/mmap.c
>> index 017bcfa..0d2fae1 100644
>> --- a/mm/mmap.c
>> +++ b/mm/mmap.c
>> @@ -193,9 +193,11 @@ static int do_brk_flags(unsigned long addr, unsigned long request, unsigned long
>>  	unsigned long retval;
>>  	unsigned long newbrk, oldbrk;
>>  	struct mm_struct *mm = current->mm;
>> +	unsigned long origbrk = mm->brk;
> 
> Is it safe to read mm->brk outside the lock?

Good catch! I guess not, parallel brk()'s could then race.

  reply	other threads:[~2018-09-27 13:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 18:10 [v2 PATCH 1/2 -mm] mm: mremap: dwongrade mmap_sem to read when shrinking Yang Shi
2018-09-26 18:10 ` [v2 PATCH 2/2 -mm] mm: brk: " Yang Shi
2018-09-27 12:14   ` Vlastimil Babka
2018-09-27 16:05     ` Yang Shi
2018-09-27 12:50   ` Kirill A. Shutemov
2018-09-27 13:21     ` Vlastimil Babka [this message]
2018-09-27 16:06     ` Yang Shi
2018-09-27 11:50 ` [v2 PATCH 1/2 -mm] mm: mremap: " Vlastimil Babka
2018-09-27 16:04   ` Yang Shi
2018-09-27 12:46 ` Kirill A. Shutemov

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=3ba966a4-abf9-1363-3e82-41fe73bc0919@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=kirill@shutemov.name \
    --cc=ldufour@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).