Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757101AbaAGCjz (ORCPT ); Mon, 6 Jan 2014 21:39:55 -0500 Received: from g4t0017.houston.hp.com ([15.201.24.20]:32840 "EHLO g4t0017.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756504AbaAGCjy (ORCPT ); Mon, 6 Jan 2014 21:39:54 -0500 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 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 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" X-Mailer: Evolution 3.6.4 (3.6.4-3.fc18) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/