From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FB56C4332F for ; Sat, 15 Oct 2022 01:40:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F36B16B0072; Fri, 14 Oct 2022 21:40:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE5F26B0075; Fri, 14 Oct 2022 21:40:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D86956B0078; Fri, 14 Oct 2022 21:40:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C3C776B0072 for ; Fri, 14 Oct 2022 21:40:26 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8FD5FA0610 for ; Sat, 15 Oct 2022 01:40:26 +0000 (UTC) X-FDA: 80021478852.04.5C92865 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf23.hostedemail.com (Postfix) with ESMTP id 999CF140029 for ; Sat, 15 Oct 2022 01:40:24 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Mq5VK17DmzDsSX; Sat, 15 Oct 2022 09:37:45 +0800 (CST) Received: from [10.174.151.185] (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 15 Oct 2022 09:40:18 +0800 Subject: Re: [PATCH 3/3] hugetlb: allocate vma lock for all sharable vmas To: Mike Kravetz , , CC: Muchun Song , David Hildenbrand , Sven Schnelle , Michal Hocko , Peter Xu , Naoya Horiguchi , "Aneesh Kumar K . V" , Andrea Arcangeli , "Kirill A . Shutemov" , Davidlohr Bueso , Prakash Sangappa , James Houghton , Mina Almasry , Pasha Tatashin , Axel Rasmussen , Ray Fucillo , Andrew Morton References: <20221005011707.514612-1-mike.kravetz@oracle.com> <20221005011707.514612-4-mike.kravetz@oracle.com> From: Miaohe Lin Message-ID: <9e6af9e5-025c-8674-63bb-139e441eba74@huawei.com> Date: Sat, 15 Oct 2022 09:40:18 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20221005011707.514612-4-mike.kravetz@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665798025; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qxWQGWpIgxRsq2SCNwMfhBPOgTS3q9AV+o2bplg3su4=; b=n1MX49llSdSelAueHGS9PwhXxClezGDI79krIyTLPm6v0yZXJ0ekahn5zElaFRzNsoOgeK Fr4UywVC2mcP74r5WgeuhrJ+zYbpZxbc/WCrer8KuX2Yo8Otu1jVqS6hoX+1ryWUYUSNe1 g/RJ1eG1m3zT5UWHVXPSti5SuyvIZa8= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665798025; a=rsa-sha256; cv=none; b=abs2MjRV8mLfU7wKg86S86L8rfEEJuaQndnjOzsFc2wK56DN9P2xG61/5XgfRFx6COml8f gj7prYwRJUV7BKJ5h/j6Jibw/ISbiQRoFMXYJkVod6DmtYM51XFQbi4zRJjx2ffIsdUy4+ auuP4yZpgYg8QUADhovpphSaUgSybrY= X-Stat-Signature: wp7jujn8gwwbhfq1qgxadubaw8htw6fm X-Rspamd-Queue-Id: 999CF140029 Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1665798024-717841 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022/10/5 9:17, Mike Kravetz wrote: > The hugetlb vma lock was originally designed to synchronize pmd sharing. > As such, it was only necessary to allocate the lock for vmas that were > capable of pmd sharing. Later in the development cycle, it was discovered > that it could also be used to simplify fault/truncation races as described > in [1]. However, a subsequent change to allocate the lock for all vmas > that use the page cache was never made. A fault/truncation race could > leave pages in a file past i_size until the file is removed. > > Remove the previous restriction and allocate lock for all VM_MAYSHARE > vmas. Warn in the unlikely event of allocation failure. > > Fixes: "hugetlb: clean up code checking for fault/truncation races" > Signed-off-by: Mike Kravetz I believe this is a feasible solution. Thanks. Reviewed-by: Miaohe Lin Thanks, Miaohe Lin