Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1077061rdb; Tue, 19 Sep 2023 21:18:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5eRzG2ScRMTFLQuVdh3Q8G8pTdwFqMU6G2+syp2z5S2EfedjOd8aP5xHBECblbSHi6Bic X-Received: by 2002:a05:6870:d1c7:b0:1d6:2476:be2e with SMTP id b7-20020a056870d1c700b001d62476be2emr1817555oac.35.1695183498027; Tue, 19 Sep 2023 21:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695183497; cv=none; d=google.com; s=arc-20160816; b=YqfL8eArXtYuQ5w6VRWuV32VekGEeL0flcOvSfwc6FC/pYg3HXVQVHn8HRHwM3AoQB kZyCaTzpa3fHoHhS7zUDurQYdbNDaUT/IaUH6OPXFrp6kywL7RROXRaHVbvs//YrVL7z ehUksVJ+2CgZX9xpwLKMTVXPSrHmLJiC1/F71zieIWahFh53p99EGcMztTLlCFSgZ9AG AYC5buIJT84mDjNQsszLLW+EtQTucBB64lwWmePKJB0NI/d9OPOVi1lUWT4UcpegpdsL NYJvvJtNKek8WbJaibzRxJeBsCitsguHfsSEcrg0jowlzXHZYQRTLCS5GdWFo5fvZ1vZ zaFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=JJifyYsCIlGRb4szaWDyR09FS0+HKeKLB1D7Y92JmVo=; fh=jOJy6H2MqF43uf/6DS+8f9N0BX9lOR3NWVKssUbxAmk=; b=MASOJaqJI0/7pgKcBiUJRpI4pMji22kvE1aFxOGy6GKI3GplvmhkBJxab+9aI/OSh2 qaCzESRNVWb9gi8/OVREeLVFaDtm7EKbN861Kc5NzSQyoJU9j94lEPtBzrpGBFx9eKAq OAAq6tV9G399zNvWhoC0YtJZ0zsjgDGpyo0w8LjojOAgbbDHSExbjpFzYQypjCVfccGo 24PA1f+p1wYy++/5ZlePNYNN516X07w15AjWJDjykIZuv5JAqh0pu6ofQh71tJCwhrut gLx70d1LB42eF1GKNM/lHWPr8XN3poaTpcWmmDMdkAKmK1hq3DmJld+BQBblLbo0Qw55 wNDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id e20-20020a63d954000000b0056a9544e894si1244925pgj.397.2023.09.19.21.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 21:18:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A2F7882E7B23; Tue, 19 Sep 2023 21:10:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232564AbjITEKH convert rfc822-to-8bit (ORCPT + 99 others); Wed, 20 Sep 2023 00:10:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbjITEKF (ORCPT ); Wed, 20 Sep 2023 00:10:05 -0400 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9B63B0 for ; Tue, 19 Sep 2023 21:09:59 -0700 (PDT) Received: from imladris.home.surriel.com ([10.0.13.28] helo=imladris.surriel.com) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qioWz-0007rh-32; Wed, 20 Sep 2023 00:09:41 -0400 Message-ID: <7ddc6ba18b3fef3ed637dcd9a85e90cf4ca6ca7d.camel@surriel.com> Subject: Re: [PATCH 1/2] hugetlbfs: extend hugetlb_vma_lock to private VMAs From: Rik van Riel To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, linux-mm@kvack.org, akpm@linux-foundation.org, muchun.song@linux.dev, mike.kravetz@oracle.com, leit@meta.com Date: Wed, 20 Sep 2023 00:09:41 -0400 In-Reply-To: References: <20230920021811.3095089-1-riel@surriel.com> <20230920021811.3095089-2-riel@surriel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 Sender: riel@surriel.com X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 19 Sep 2023 21:10:07 -0700 (PDT) On Wed, 2023-09-20 at 04:57 +0100, Matthew Wilcox wrote: > On Tue, Sep 19, 2023 at 10:16:09PM -0400, riel@surriel.com wrote: > > From: Rik van Riel > > > > Extend the locking scheme used to protect shared hugetlb mappings > > from truncate vs page fault races, in order to protect private > > hugetlb mappings (with resv_map) against MADV_DONTNEED. > > > > Add a read-write semaphore to the resv_map data structure, and > > use that from the hugetlb_vma_(un)lock_* functions, in preparation > > for closing the race between MADV_DONTNEED and page faults. > > This feels an awful lot like the invalidate_lock in struct > address_space > which was recently added by Jan Kara. > Indeed it does. It might be even nicer if we could replace the hugetlb_vma_lock special logic with the invalidate_lock for hugetlbfs. Mike, can you think of any reason why the hugetlb_vma_lock logic should not be replaced with the invalidate_lock? If not, I'd be happy to implement that. -- All Rights Reversed.