From patchwork Wed Mar 6 23:23:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 13584768 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D338C5475B for ; Wed, 6 Mar 2024 23:24:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 713E96B00A5; Wed, 6 Mar 2024 18:24:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 706126B00B6; Wed, 6 Mar 2024 18:24:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59B526B00B5; Wed, 6 Mar 2024 18:24:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 444A56B0088 for ; Wed, 6 Mar 2024 18:24:04 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0FCE9A162F for ; Wed, 6 Mar 2024 23:24:04 +0000 (UTC) X-FDA: 81868194408.27.1723A1A Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by imf20.hostedemail.com (Postfix) with ESMTP id 0D58E1C000D for ; Wed, 6 Mar 2024 23:24:01 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of richard@nod.at designates 195.201.40.130 as permitted sender) smtp.mailfrom=richard@nod.at ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709767442; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B0V4g+p69F8oNBdtJGrMdvum296Q4WdVoj47/Gt9H+0=; b=mN6hR3oTEOdXSfsqauIiTO8QUuG2LHFPBETSihAVvaOAQvIbBwpaNJKkA5Pj8uSH+0LuAw FylevtkMrReLas7OS2/+UdlmYwTENn21f7xPdeine3yxgGypPVJAkRcyaS7gtOJJ+eZv1l cu8OhSjMx5Myz8hafeKktg+ZircT9ng= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of richard@nod.at designates 195.201.40.130 as permitted sender) smtp.mailfrom=richard@nod.at ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709767442; a=rsa-sha256; cv=none; b=hK++dhzeIh/3PjqkxIljicegJeTLRYbaBJRAsap0zuv5OTjZDgILX6p3YE9sNrzwfqlAMl mrm7VTeB/Y1JUbp1zkt5a6OEWK8t6ehiQpXPynpUvBNVqnSV/1q/9Si92RyenXrCIDD8Ks TwW/1lnXwpFaQhYU6nYHUp3sIepWVh0= Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 31F55644CE7D; Thu, 7 Mar 2024 00:24:00 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id oPswx8eCA2gS; Thu, 7 Mar 2024 00:23:59 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id BA63A644CE7B; Thu, 7 Mar 2024 00:23:59 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 3UwmHEFZi2bY; Thu, 7 Mar 2024 00:23:59 +0100 (CET) Received: from foxxylove.corp.sigma-star.at (unknown [82.150.214.1]) by lithops.sigma-star.at (Postfix) with ESMTPSA id 474EC644CE7C; Thu, 7 Mar 2024 00:23:59 +0100 (CET) From: Richard Weinberger To: linux-mm@kvack.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, upstream+pagemap@sigma-star.at, adobriyan@gmail.com, wangkefeng.wang@huawei.com, ryan.roberts@arm.com, hughd@google.com, peterx@redhat.com, david@redhat.com, avagin@google.com, lstoakes@gmail.com, vbabka@suse.cz, akpm@linux-foundation.org, usama.anjum@collabora.com, corbet@lwn.net, Richard Weinberger Subject: [PATCH 2/2] [RFC] pagemap.rst: Document write bit Date: Thu, 7 Mar 2024 00:23:39 +0100 Message-Id: <20240306232339.29659-2-richard@nod.at> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240306232339.29659-1-richard@nod.at> References: <20240306232339.29659-1-richard@nod.at> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 0D58E1C000D X-Stat-Signature: f8gi4df6e9eyxagqgf9t7enazoxpq3pd X-Rspam-User: X-HE-Tag: 1709767441-438075 X-HE-Meta: U2FsdGVkX1+nYDg167ZEiod2arqIhrCI18vsRc4ok5WLMBN5ngOU9ZsZjK7G2kXgN5JrZhDjycV/SHJaCd5wAyErkxV5f4slYQu1ed6n2sA92xAugjzg6iPc49lfDv/uU8mOJETwQ4oK/dtF+67iFdlQ+lTXNdTwBkqqAlAPytzm0LuQYH6pQSp0aCnpwEwx0KX7yRFKFSexg/iypYFbThcewTJoi7tmOzETFZpP1tdwCG5YGKmaooRWu3QjLi1DSvSWJwISwhA+qd7hPI6E4rgNNYLS4Ztxbk1bhAdTvMYfR2jVBjwwUD9ZHkrwk0++EawWqn951oua7O/C25KNflXlJWqIirb3ZKrWxC0EoRP+gLA5h80xx+BdqmLpIP+mV6HBTjC/RCdk0zo948J7evNzBGP6Yc9APt9ikIaDFByGqaTlkNAVaPsnggO43FHa3Kp4gP/WKe084P24X9/GPf0XEJxSv141mVBSPMa8s9NcwN7YMh3+2tsS7rwDKf+YqHTklNDDhARUAKnsQB4ea0YiHvYmeMTKRKrs/GiQqbXqzLHyXL8KMQkMJJFDMnV8mV6MMKyqFy6uHNePofObMCeSgJtEt8VdDfrkbP4AOenKZo/trXryAri9yTT989XzO/9IBvUpHgb4tz9PNaeIF59sN1/qJksstCan3dAJppENBe5/m7LzyxrSYX8sF6TBJDyZUoZqw8LENs+HwWlsdmpffD2W4eVj/frBgRZ6Eo8Y0hjfnGYu1BeWd1893/k46NJGV9QDz0zgVx1Ij6XLNIQOjgrP3CJGIT/6T8nVgb/KiJUAOIFo2dpL83fdsjhHUt/8bp0VY7cNnAkrm9+0U65ku0CHJqa8c3RWbyKX+c4DWO6sRQWqGgSycdQMto0Q X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Bit 58 denotes that a PTE is writable. The main use case is detecting CoW mappings. Signed-off-by: Richard Weinberger --- Documentation/admin-guide/mm/pagemap.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/mm/pagemap.rst b/Documentation/admin-guide/mm/pagemap.rst index f5f065c67615..81ffe3601b96 100644 --- a/Documentation/admin-guide/mm/pagemap.rst +++ b/Documentation/admin-guide/mm/pagemap.rst @@ -21,7 +21,8 @@ There are four components to pagemap: * Bit 56 page exclusively mapped (since 4.2) * Bit 57 pte is uffd-wp write-protected (since 5.13) (see Documentation/admin-guide/mm/userfaultfd.rst) - * Bits 58-60 zero + * Bit 58 pte is writable (since 6.10) + * Bits 59-60 zero * Bit 61 page is file-page or shared-anon (since 3.5) * Bit 62 page swapped * Bit 63 page present @@ -37,6 +38,11 @@ There are four components to pagemap: precisely which pages are mapped (or in swap) and comparing mapped pages between processes. + Bit 58 is useful to detect CoW mappings; however, it does not indicate + whether the page mapping is writable or not. If an anonymous mapping is + writable but the write bit is not set, it means that the next write access + will cause a page fault, and copy-on-write will happen. + Efficient users of this interface will use ``/proc/pid/maps`` to determine which areas of memory are actually mapped and llseek to skip over unmapped regions.