Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1200337rdb; Wed, 20 Sep 2023 02:30:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnazJrR1xa1WCAbzuQbr4ZRdNdlqUFqugteCE1tRO+VNYCLbR234Jn1gxXNzu4Otgexz6m X-Received: by 2002:a17:902:7146:b0:1c1:e7b2:27ad with SMTP id u6-20020a170902714600b001c1e7b227admr1470259plm.60.1695202230820; Wed, 20 Sep 2023 02:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695202230; cv=none; d=google.com; s=arc-20160816; b=Zl/UfSS2bfXbOlZ7qizAeq0G4SFyysKHHG7M8XwO5TZL7oT7HyibN3+Ns7W0bRLHp6 h88XXnP+BwYn1F/NzaLG/KigOImDKK04tZmYxVYQbm3cWJnvE+XizaDsUjIvn9yVTTnR okFt/04JK78sXL2z0Ii/ANqtPVUn+KJTaXzjE5Pz6sIo8EIvBEEUVBbKdFyQFDsiYU4y x6cq6p0GWLmzwQSaC9njXxmOAAttCXUjO8iaHJ0j8Z6kCj/uTwstK6TbHWe9FjeLdJ96 yZGCGcD1nmN0+9Ts2yhGi1EDmqxvdSof7zTlBmMhhcRcYkQ1ILCVnpssg6FGuWKf2/jv KAfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=A1BPMwH2UDIlMDkUUSRsazWTjzTwQxn28F0/xEN7Fd4=; fh=UUOpEpoBKdik7ESICDn4TuuRYsrpUq55g2F5JY7ewXg=; b=m4Sc7ku+gqjU0V4NnPre7EMmBruV7XlJWIK/SRMHGfksPadB9eCrEdpx6sCckobuyN XausYXimd0m2IaTivHTL3JoJrXBLzH9swY7OTIv2eoNAqdd83/tc1hTTTu+h4klN2vUU jgQsqoVF4xaL0rVS6CHq6ZseM7jXFZ0KxK3HF9nYxWocZ5zLhelGFbowXxyFbyQxKfVk yf0/+Is9iAxzuTYJ8nFNzlEEe2p2hWGRZaAfVL6YCZyQIbXwbXZJG10x2gRDAK5mD9I9 fNvZgXzYPU/NWIPuG07Y8ugENqZI5xJrzHERorfr4jmPe7JxbghQ88GIhDcwnV9WMeYR mYUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=swRfjP1T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id bd12-20020a170902830c00b001c41515c4c7si10703438plb.115.2023.09.20.02.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 02:30:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=swRfjP1T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id E777F8303B14; Tue, 19 Sep 2023 20:58:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232547AbjITD6Z (ORCPT + 99 others); Tue, 19 Sep 2023 23:58:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232602AbjITD6I (ORCPT ); Tue, 19 Sep 2023 23:58:08 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2A5DF4 for ; Tue, 19 Sep 2023 20:57:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=A1BPMwH2UDIlMDkUUSRsazWTjzTwQxn28F0/xEN7Fd4=; b=swRfjP1TPecEPIMAREeGgZUpCV gyR9XRsySpjeM4V6BJvBRG2OpeK6665cqxzP2t59HDLQ4KawzavOowyjJVBtf+HuZ0ijua423WLzF SbDyI8V1NzhvMSjyD2HCWnEYr18f3vzWkCL/Tu/x9m+VhA/rcg+sXuJrkspvNuhvPBDNBiFQkW5eC PUa3IH/XU+OQC25+8qO5IzX/3JQ9b2IHHwgpDkZqvlLjt49Jzzbte8o6HQwxQCmqH6yY/CEQkA+S3 xHbUsbfwH1vCG22QG69ZrBp4NFP8L/JxgpQbtwtw0pUE33jYQCEYj+LaGc92BjHt/L42kLS+NLqZk oK3dPDpg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qioLF-003aQw-7D; Wed, 20 Sep 2023 03:57:33 +0000 Date: Wed, 20 Sep 2023 04:57:33 +0100 From: Matthew Wilcox To: riel@surriel.com 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 Subject: Re: [PATCH 1/2] hugetlbfs: extend hugetlb_vma_lock to private VMAs Message-ID: References: <20230920021811.3095089-1-riel@surriel.com> <20230920021811.3095089-2-riel@surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230920021811.3095089-2-riel@surriel.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Tue, 19 Sep 2023 20:58:27 -0700 (PDT) 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.