Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3129624rwb; Wed, 30 Nov 2022 16:02:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf4vfxjn5Ed8cRvA4IbGMlCb8A2j3gfVLH28FFFCX9LmOgtgcm2RkNZvsR3bWTgJOUX8JhGL X-Received: by 2002:aa7:d89a:0:b0:46b:e5cd:40d8 with SMTP id u26-20020aa7d89a000000b0046be5cd40d8mr1240771edq.220.1669852934422; Wed, 30 Nov 2022 16:02:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669852934; cv=none; d=google.com; s=arc-20160816; b=GjwdJTh9QQFIVD9elQJ6PKtwdBNa8zX0jNAA2FHJ/OKHc4I7Sczx1TWrt57/PkKAB+ hedxPvRg66invnpNbjUIKedghJBai1nhoYTerXXcCYMLxGV+gAGtehnKtiVwrZivGnk9 MTWEBFstJnB9mX6xWMm7vyubZb64fHFVkc1qTRaOQ91Nikh3K20HFjU2d9fMIgpgBUI1 fwslf4JHGtd/Jl8q1IZRaIdNgAwcSq6R9K3rR5e7cKt4RsjTrA7z6VxPpyRshRfsxsxI v9nVU1h9oWgnN3hOk45sA/PNB8DsfLkMjpZMCyCHLV6vp2i/Umy5a+XxtSe3SMltPFkb qs5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sVGmk8iXfRJi6LHpCkuFJ1XLyGvMWqmOzcPL5P0XpHM=; b=A6gUV8CK5Ed2RQg3XfnVZsYZZIuHjZw8Xz0/cHrEJWvdyin6nUGB5SDzdrx+MgwbJ4 D5eD8iGsiimJwZoTo/xBYqjU6cVquiZKvTmJ+YDSznjcCJy2ROqhChHAIe4zc2s7+V/l Ge4qkI3c+P4YmL6I8VNy74TWTqxPCvh93pgg/GEeGCkl3veZDGqpIHABFPq94iE5ZOgS 9OAdNkeGqXlc4S73rzYRTr4DKc3Io63bqgVj6HWvFlXUwgPJcJ1iuQtVXHcKn8fRqV4J jouO+GccKC65eRZx2UEF74yEzQzIqTJPQivJDqvwgtQYsOZzM39C5JB0nD20vrHSqNcY Fp7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qgKMTJUm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds18-20020a170907725200b0078da414a7cesi2711850ejc.149.2022.11.30.16.01.54; Wed, 30 Nov 2022 16:02:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qgKMTJUm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229954AbiK3Xc7 (ORCPT + 83 others); Wed, 30 Nov 2022 18:32:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbiK3Xci (ORCPT ); Wed, 30 Nov 2022 18:32:38 -0500 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4D5E90762 for ; Wed, 30 Nov 2022 15:29:15 -0800 (PST) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-3b56782b3f6so119057b3.13 for ; Wed, 30 Nov 2022 15:29:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sVGmk8iXfRJi6LHpCkuFJ1XLyGvMWqmOzcPL5P0XpHM=; b=qgKMTJUmPzLXdl3XUPHNLrMjWcbRNKXVr40/b1Cb+68B0JvcoIL+DdetThrvro0I2e Mq3y5U5KHVuJwxTJKuWjfdhdGTB9IZiF6piakctChUJzF4d1ukV3i//n0YzT8bF1UfdK fTYHnjvrlrF1qultVw8XUPzq49LgchZe/fU/zQG+2Dsd0Hpbnhqmzw+21XdStKI2ra30 sZe4lMpAfZTLmSrjd2v5QPu21SzQSsObnFk/0EqFlguUCzBENGfzq30zrzJ34ZmXfrKu G3PYZJL53gDDRrBIhNgaaRKaOtourUk3LB29/ZeHVJfrZpbcreEJ9AMWx/OJNfZjvZSQ H9Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sVGmk8iXfRJi6LHpCkuFJ1XLyGvMWqmOzcPL5P0XpHM=; b=OgW2awtZpVxviuRldkyEEr1n8XJAXweHWx8JVEDuH3pGSa+2DqN3+CZ0qD3F6h6HfL LMsfm2Se0dCvLhw8tJYiME9hENzVl7vLB8ahekiBLl/FeL/iuF7cFFLPWxULe/4heC0/ /cTnbrKdPkqdiDSq7L1cBWtm1C6vXtDggr3xNk641A/Px33YEhermDpPMOIuehpJCe7k A2kZc/GjHAzh+DWrpaTvdQ3rc6OIXEMnQWuiJcpKJxs0FpDbRRDAghEPH1SpIs+w/jbo q2GnsBw5YMeJ9tx+Ac8HQeLwu+NbOAT0hz8Es8XApGC1cnBsGpZLOLAuoIutI6QPCIRX DKZg== X-Gm-Message-State: ANoB5plSO5skOGNjDOpdQRSSYKinrOyvS72SaDhuATH92u+rr/2clnxz IzDfvedwMdm8gkaKSD3XcmqPp2aqBXwdtBwwYqD26Q== X-Received: by 2002:a81:4602:0:b0:35f:9c14:144a with SMTP id t2-20020a814602000000b0035f9c14144amr60796886ywa.209.1669850954990; Wed, 30 Nov 2022 15:29:14 -0800 (PST) MIME-Version: 1.0 References: <20221021163703.3218176-1-jthoughton@google.com> <20221021163703.3218176-7-jthoughton@google.com> In-Reply-To: From: James Houghton Date: Wed, 30 Nov 2022 18:29:04 -0500 Message-ID: Subject: Re: [RFC PATCH v2 06/47] hugetlb: extend vma lock for shared vmas To: Peter Xu Cc: Mike Kravetz , Muchun Song , David Hildenbrand , David Rientjes , Axel Rasmussen , Mina Almasry , "Zach O'Keefe" , Manish Mishra , Naoya Horiguchi , "Dr . David Alan Gilbert" , "Matthew Wilcox (Oracle)" , Vlastimil Babka , Baolin Wang , Miaohe Lin , Yang Shi , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Wed, Nov 30, 2022 at 4:01 PM Peter Xu wrote: > > On Fri, Oct 21, 2022 at 04:36:22PM +0000, James Houghton wrote: > > This allows us to add more data into the shared structure, which we will > > use to store whether or not HGM is enabled for this VMA or not, as HGM > > is only available for shared mappings. > > > > It may be better to include HGM as a VMA flag instead of extending the > > VMA lock structure. > > > > Signed-off-by: James Houghton > > --- > > include/linux/hugetlb.h | 4 +++ > > mm/hugetlb.c | 65 +++++++++++++++++++++-------------------- > > 2 files changed, 37 insertions(+), 32 deletions(-) > > > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > > index a899bc76d677..534958499ac4 100644 > > --- a/include/linux/hugetlb.h > > +++ b/include/linux/hugetlb.h > > @@ -121,6 +121,10 @@ struct hugetlb_vma_lock { > > struct vm_area_struct *vma; > > }; > > > > +struct hugetlb_shared_vma_data { > > + struct hugetlb_vma_lock vma_lock; > > +}; > > How about add a comment above hugetlb_vma_lock showing how it should be > used correctly? We lacked documents on the lock for pmd sharing > protections, now if to reuse the same lock for HGM pgtables I think some > doc will definitely help. > > To summarize, I think so far it means: > > - Read lock needed when one wants to stablize VM_SHARED pgtables (covers > both pmd shared pgtables or hgm low-level pgtables) > > - Write lock needed when one wants to release VM_SHARED pgtable pages > (covers both pmd unshare or releasing hgm low-level pgtables) > > Or something like that. Will do. I'll make this change together with the rmap comment update ("rmap: update hugetlb lock comment for HGM"). - James > > -- > Peter Xu >