From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx181.postini.com [74.125.245.181]) by kanga.kvack.org (Postfix) with SMTP id A04C26B0005 for ; Thu, 4 Apr 2013 14:48:02 -0400 (EDT) Received: by mail-ve0-f169.google.com with SMTP id d10so2971322vea.28 for ; Thu, 04 Apr 2013 11:48:01 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 4 Apr 2013 11:48:01 -0700 Message-ID: Subject: Re: [PATCH] mm: prevent mmap_cache race in find_vma() From: Linus Torvalds Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: Hugh Dickins Cc: Andrew Morton , Jan Stancek , Jakub Jelinek , David Rientjes , Johannes Weiner , "Paul E. McKenney" , Ian Lance Taylor , linux-mm , Linux Kernel Mailing List On Thu, Apr 4, 2013 at 11:35 AM, Hugh Dickins wrote: > > find_vma() can be called by multiple threads with read lock > held on mm->mmap_sem and any of them can update mm->mmap_cache. > Prevent compiler from re-fetching mm->mmap_cache, because other > readers could update it in the meantime: Ack. I do wonder if we should mark the unlocked update too some way (also in find_vma()), although it's probably not a problem in practice since there's no way the compiler can reasonably really do anything odd with it. We *could* make that an ACCESS_ONCE() write too just to highlight the fact that it's an unlocked write to this optimistic data structure. Anyway, applied. Linus -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org