Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2964139rwb; Wed, 30 Nov 2022 13:23:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf5F/jkaEjeOxkCezzzyL8wEPOZx1yM9HY4ORJ7I8fUFk+72VWp6GHr1+zOpghXda+j621uj X-Received: by 2002:a17:902:c755:b0:189:58a8:862c with SMTP id q21-20020a170902c75500b0018958a8862cmr33767738plq.163.1669843382034; Wed, 30 Nov 2022 13:23:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669843382; cv=none; d=google.com; s=arc-20160816; b=ceAlLFyz9da0CdPscd7LciNlJWunjJrrSrqdce0F0TAWD6M0DCG/Xr335lY76EOiRb e4WIwTK4kAh4rsqNqsWyMvlx5O2mDhqi3FAL4Jr3m2W4aUdCyzumWSeFH50WXeBghqI2 apxtZ+LWv57hjnxCBO4M3hSR2ZV7oXM58/s0jKeYPeQtGoVhl9Rmwfj9HonV9KLWrr6i Zv/zY/G2xnByymWC6nkVUmKwIPfVaqSLiIMXte1Kau6G2tYuMroQY71ZXWS5YvgmsGDF Rx7oBe9YjfQByGA+AMkAFbAwPyl0+hCGm1tN7ysZK3u1gWuSfqnqNW3RYV1KyfgDx0B/ z3Ww== 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=L42rLHtFBFKGLDIxtx1wN/+Aa4flR65WbTjaBq4HhSM=; b=HxSsKi1zpmnymGSOrQ2W9Zx5MzYALwE7Ll5GrBLs1HEhGUZ0rf8X2dT4s0EflDhOPj Y0Y7+ahASi808UYEGRUsef1xn4Yk3gp/wmyzXfBCXLr7tty2jOFuaJ2+hp7BynXoZwjT rFUl85Hg9tlWzGhkUrOombUjQ0gfzd7Mcc3QR1YZWOAyQTj8koQASCcvKKS4E1ho6zAE XHORbyw8e0e+BeYAhEHUPj5fmu7DhNA6HSWvQ9oz49ekmb1shaMp88Hwa18sywakUCgk BnMovq5ZvdcCJi4ZMsfmppsMUjN9uuOaOZkZ8uRD1W4rlXQO3EJH29I7lKjz2jrEm2N6 deKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=etDjANrO; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a63da14000000b0046f75b665b8si2259828pgh.757.2022.11.30.13.22.50; Wed, 30 Nov 2022 13:23:02 -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=@redhat.com header.s=mimecast20190719 header.b=etDjANrO; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229734AbiK3VCG (ORCPT + 83 others); Wed, 30 Nov 2022 16:02:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbiK3VCD (ORCPT ); Wed, 30 Nov 2022 16:02:03 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF3618324A for ; Wed, 30 Nov 2022 13:01:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669842069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=L42rLHtFBFKGLDIxtx1wN/+Aa4flR65WbTjaBq4HhSM=; b=etDjANrOPvhVjIdeDE2GnJozHf412ibQuH0TFdAvSew3/0q/wP9Dxof7hHDlhY76gRY1Hy XZWRi8e0ZFayRUCwbNBg4iNttEAG4xO9tGHYXfECBSLPA1VjnMoZTboXTDyqdrVRC+yLjG 2NQPjFC/6qWZzv/zwHEJlXp/Cf4k2D4= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-446-NUVBCnCDODyc84hwMXHvmw-1; Wed, 30 Nov 2022 16:01:07 -0500 X-MC-Unique: NUVBCnCDODyc84hwMXHvmw-1 Received: by mail-qv1-f72.google.com with SMTP id nn2-20020a056214358200b004bb7bc3dfdcso28752055qvb.23 for ; Wed, 30 Nov 2022 13:01:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=L42rLHtFBFKGLDIxtx1wN/+Aa4flR65WbTjaBq4HhSM=; b=40tny7ZdcOcf4WuZogyPSW258Kw917uZZPPpfvqYUj3brVpSkCdt6+yAQLnFodSBHe 8LCNHDSaSzBqRLsWNd3wb54a6NzbzonFP4ZQi61EQ5w7nvwBsJq0Y3O5aWUzG2wuXsQR ca5qTd9TRiRHpi8U2FISO2eGq5YToDgQHr7GZbdW9jzW6IM2QQeyVwllstGpXqc32EqI lXs1/1mdHF4B0YLo8buv2u+NV7CJNVy3tZTv5qlofCqO2vxcUIQJxTE5JRH9XFQgUy6z g+mSILwRwJAZuBlyNar8p3M4jqbeGRUgdtRlKfBtzrnS2YI5BcXm23klAwy6QS7pGVYL 5m9Q== X-Gm-Message-State: ANoB5plmCVxXJmpNG80czs/LzRC4rN/LIiGT5l6PGPqN8kUmwBLE9bsc /ScTTXPMgm87MvVxSvSBbFRURJd/TR2s89mbmUWhuuWhNV4NrtRvnC9pUa6oCEyHtChHc1ZZu4H gxDc8uw5PsWYjfsLtforsmNHP X-Received: by 2002:a0c:fec3:0:b0:4c6:86be:a0c9 with SMTP id z3-20020a0cfec3000000b004c686bea0c9mr40024928qvs.123.1669842066639; Wed, 30 Nov 2022 13:01:06 -0800 (PST) X-Received: by 2002:a0c:fec3:0:b0:4c6:86be:a0c9 with SMTP id z3-20020a0cfec3000000b004c686bea0c9mr40024868qvs.123.1669842066197; Wed, 30 Nov 2022 13:01:06 -0800 (PST) Received: from x1n (bras-base-aurron9127w-grc-46-70-31-27-79.dsl.bell.ca. [70.31.27.79]) by smtp.gmail.com with ESMTPSA id u19-20020a05620a0c5300b006fa84082b6dsm1858982qki.128.2022.11.30.13.01.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 13:01:05 -0800 (PST) Date: Wed, 30 Nov 2022 16:01:04 -0500 From: Peter Xu To: James Houghton 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 Subject: Re: [RFC PATCH v2 06/47] hugetlb: extend vma lock for shared vmas Message-ID: References: <20221021163703.3218176-1-jthoughton@google.com> <20221021163703.3218176-7-jthoughton@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221021163703.3218176-7-jthoughton@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 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. -- Peter Xu