From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-f182.google.com (mail-ig0-f182.google.com [209.85.213.182]) by kanga.kvack.org (Postfix) with ESMTP id 43F246B0031 for ; Mon, 6 Jan 2014 21:39:55 -0500 (EST) Received: by mail-ig0-f182.google.com with SMTP id c10so466756igq.3 for ; Mon, 06 Jan 2014 18:39:55 -0800 (PST) Received: from g4t0017.houston.hp.com (g4t0017.houston.hp.com. [15.201.24.20]) by mx.google.com with ESMTPS id il4si18224933icb.51.2014.01.06.18.39.53 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 06 Jan 2014 18:39:54 -0800 (PST) Message-ID: <1389062386.9937.3.camel@buesod1.americas.hpqcorp.net> Subject: Re: [PATCH v3 03/14] mm, hugetlb: protect region tracking via newly introduced resv_map lock From: Davidlohr Bueso Date: Mon, 06 Jan 2014 18:39:46 -0800 In-Reply-To: <1387349640-8071-4-git-send-email-iamjoonsoo.kim@lge.com> References: <1387349640-8071-1-git-send-email-iamjoonsoo.kim@lge.com> <1387349640-8071-4-git-send-email-iamjoonsoo.kim@lge.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Joonsoo Kim Cc: Andrew Morton , Rik van Riel , Mel Gorman , Michal Hocko , "Aneesh Kumar K.V" , KAMEZAWA Hiroyuki , Hugh Dickins , Davidlohr Bueso , David Gibson , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joonsoo Kim , Wanpeng Li , Naoya Horiguchi , Hillf Danton On Wed, 2013-12-18 at 15:53 +0900, Joonsoo Kim wrote: > There is a race condition if we map a same file on different processes. > Region tracking is protected by mmap_sem and hugetlb_instantiation_mutex. > When we do mmap, we don't grab a hugetlb_instantiation_mutex, but, > grab a mmap_sem. This doesn't prevent other process to modify region > structure, so it can be modified by two processes concurrently. > > To solve this, I introduce a lock to resv_map and make region manipulation > function grab a lock before they do actual work. This makes region > tracking safe. > > Signed-off-by: Joonsoo Kim Reviewed-by: Davidlohr Bueso -- 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