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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9A2CFC54E66 for ; Wed, 13 Mar 2024 21:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AE8jV/PGlmUC80Q2U2ALB7QQEJ826lxQD4RjL9gvhLY=; b=EYyKLgeX59E1Sa eJieQloAcWVMnHsolpBmKtjazKG1TUliADjD5qMHD6jonaJp/ZWpIg5sCeRtnr/8B4en9uJ36t5lS IH1jSuV1WNUD2YufMI8slpGT2xLui0Bol9H2e3D0c3YmlcgrcyFNp5d5aC0sfyFqwitf6af9M9rN/ 0Re442RTLy0cQopf8Tnz90Pdl9FNn/Py0+6YEwo7L7mcwy0ESEyDmzxr+ql4wE7dM9fjI9k7gmKkU gwk4dGJAVi0gOiT6FTtjfLtiCDlIxPYYSHwHwYt4GyeknSRrHfdfz4tHUlq3ZnDzCha2MLkKiORX6 WKwdnAXnqwIYXHqZphoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkWSM-0000000C0ed-21Ro; Wed, 13 Mar 2024 21:48:14 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkWRu-0000000C0IV-0u8O for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2024 21:47:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710366465; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RceLUqudgSYtio91tFrZNJeoSc+POoSD4WuQnIajVyw=; b=BYeqR4v7AYrv1j+ds7Zja+/IuWlBQZ79IGTyDMSRsqrhghcEL+j7XhAY/MU31iBQY19Hsd CO40r50pAvu7gSJRb7d5ePCfOhkm5XMm9r0h9LePyDOq3Xg2gRHbRW16rXt2mGrYCe292r iQnTdCZknsqtmIxIznh8+Y20ET2IXPk= 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_256_GCM_SHA384) id us-mta-684-e5c-7ogNOTubm2zNkVwmew-1; Wed, 13 Mar 2024 17:47:41 -0400 X-MC-Unique: e5c-7ogNOTubm2zNkVwmew-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-69120b349c9so1132136d6.1 for ; Wed, 13 Mar 2024 14:47:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710366461; x=1710971261; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RceLUqudgSYtio91tFrZNJeoSc+POoSD4WuQnIajVyw=; b=n7mkru1LIboodnbPAbUhZW+1ewFTpr6EhvoPE5OWj4XxYOusAbC5bM8BQTXEdz6QVU PO8G4PCqF74c2zvbIrbRkf2UER2dT1N5of6z1NZX02fE/KXSBI38dWUj561T7uIv8ooA VtTzg7Dh6AdPu1JOUER2ckcTORaWTmXDCypblwOd2sDhUg7Dnu6/0moXyL7cS8gEsKru y3BWloDN00xeysGQOlsJl/8nXmBotvLNXP3Z5teNWFLg4xYdTnFOhydI2wbRNgsIIQ3p J/kH4lEdJfD2l5BKDEAuR/vNuO9pR0utxwhTxYZNnuI8d2Nfn6wAvK45+6Up01TRTEfo 8SYw== X-Gm-Message-State: AOJu0YwRH5UVEnCUKKxKbjA7CnnAKxa3bRpmFR4lwJKa9cQ1EPEdBl83 am4tzeYla5oh084Bn5pjlUHPagkwK1ZtiddzGVw2+cLd5uc+fMBDXD2nXF/XfHnoyfCRoRKO+C/ E4xk1cPoQKNFfYjF6sPj7W6x+PC8BdtluDxUxLdRlcswlnqZIcQn0p9mqqn2i9Yk2rlkxuQ1GtP MYmN4Q X-Received: by 2002:a0c:eb83:0:b0:68f:e779:70f2 with SMTP id x3-20020a0ceb83000000b0068fe77970f2mr5934047qvo.3.1710366461088; Wed, 13 Mar 2024 14:47:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzQ7u+SJJkcqXmUXcq37q3NbZvmeXcFSg9ZX/No2VaFoCndSeWwMBLZUu/Dqoea36C4ilydg== X-Received: by 2002:a0c:eb83:0:b0:68f:e779:70f2 with SMTP id x3-20020a0ceb83000000b0068fe77970f2mr5934040qvo.3.1710366460771; Wed, 13 Mar 2024 14:47:40 -0700 (PDT) Received: from x1n.redhat.com ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id dv10-20020ad44eea000000b0069111c5cdd4sm60114qvb.100.2024.03.13.14.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 14:47:39 -0700 (PDT) From: peterx@redhat.com To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: linux-arm-kernel@lists.infradead.org, Matthew Wilcox , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , Andrew Morton , x86@kernel.org, peterx@redhat.com, Mike Rapoport , Muchun Song , sparclinux@vger.kernel.org, Jason Gunthorpe Subject: [PATCH 13/13] mm: Document pXd_leaf() API Date: Wed, 13 Mar 2024 17:47:19 -0400 Message-ID: <20240313214719.253873-14-peterx@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240313214719.253873-1-peterx@redhat.com> References: <20240313214719.253873-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240313_144746_501901_7E2B4ACC X-CRM114-Status: GOOD ( 15.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peter Xu There's one small section already, but since we're going to remove pXd_huge(), that comment may start to obsolete. Rewrite that section with more information, hopefully with that the API is crystal clear on what it implies. Reviewed-by: Jason Gunthorpe Signed-off-by: Peter Xu --- include/linux/pgtable.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 85fc7554cd52..6b0d222a7fad 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1770,11 +1770,25 @@ typedef unsigned int pgtbl_mod_mask; #endif /* - * p?d_leaf() - true if this entry is a final mapping to a physical address. - * This differs from p?d_huge() by the fact that they are always available (if - * the architecture supports large pages at the appropriate level) even - * if CONFIG_HUGETLB_PAGE is not defined. - * Only meaningful when called on a valid entry. + * pXd_leaf() is the API to check whether a pgtable entry is a huge page + * mapping. It should work globally across all archs, without any + * dependency on CONFIG_* options. For architectures that do not support + * huge mappings on specific levels, below fallbacks will be used. + * + * A leaf pgtable entry should always imply the following: + * + * - It is a "present" entry. IOW, before using this API, please check it + * with pXd_present() first. NOTE: it may not always mean the "present + * bit" is set. For example, PROT_NONE entries are always "present". + * + * - It should _never_ be a swap entry of any type. Above "present" check + * should have guarded this, but let's be crystal clear on this. + * + * - It should contain a huge PFN, which points to a huge page larger than + * PAGE_SIZE of the platform. The PFN format isn't important here. + * + * - It should cover all kinds of huge mappings (e.g., pXd_trans_huge(), + * pXd_devmap(), or hugetlb mappings). */ #ifndef pgd_leaf #define pgd_leaf(x) false -- 2.44.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel