From patchwork Fri Apr 4 14:06:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pankaj Raghav (Samsung)" X-Patchwork-Id: 14038522 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 8D8C1C36010 for ; Fri, 4 Apr 2025 14:07:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B99466B0024; Fri, 4 Apr 2025 10:07:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B47986B0025; Fri, 4 Apr 2025 10:07:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A0E086B0026; Fri, 4 Apr 2025 10:07:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 83C596B0024 for ; Fri, 4 Apr 2025 10:07:08 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 89DF48029E for ; Fri, 4 Apr 2025 14:07:09 +0000 (UTC) X-FDA: 83296538178.30.CA2DC50 Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by imf15.hostedemail.com (Postfix) with ESMTP id 8BB4CA0016 for ; Fri, 4 Apr 2025 14:07:07 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=whQHZy5T; spf=pass (imf15.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743775628; 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:references:dkim-signature; bh=d3LlMKgq7dBlVlNItWKVgpXkIcgbMa8xNdNgsyJKxAM=; b=QlnfLkttBNl8me5iEYOxwR9PsH5vYgFcrMUs7jdqYAp/22Y8zFzvHzIKXtgVfqoNt1tVHH CcNhCB2AMfcqLsJn1G94ipfsi6TdLcNLbBzlXIkf4UaBIATLQDLsBMfbz25p7Z67530COf X3EKKD8ou1/beqqD6uq9ep6gMepiZKQ= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=whQHZy5T; spf=pass (imf15.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.151 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743775628; a=rsa-sha256; cv=none; b=JVqF1yxJzVFGkrFwHfLQkMl1FzzAmkL5oXaFKcwCLGKoMhDS7jzgxZkeDUNX1yHHlOc74D Wf4kGIwXUlGNBh6f5DOZW76kbmEHsovRHqvJaZVEGMS3D1Db8BDa9IY3BFyGeQzagcUfuN 1WmrO/phc42GQ0kukd3yNDWWFEfgYNo= Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4ZTgQZ6fzfz9t1V; Fri, 4 Apr 2025 16:07:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1743775623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=d3LlMKgq7dBlVlNItWKVgpXkIcgbMa8xNdNgsyJKxAM=; b=whQHZy5TryGkrcao/56NMXr9BSIDzrhhw/CJjRYFZKIFT51nZ+xw7DbYoi3dYCEEKkQy1v tIUJhIBcIRC0Cf10W45O5/taj9HdgHqhTMb3147cdgoc8iY00DVc3SW9GkEd0zBGG0PeTK clizK9FRHiA61i/LDYEAnYKY/r5A/g1F7CRSnp8n59lKblgM30YB89ZkKI3LlbjPk/BXhf kFl0yJckd3fAMJsWI8sQVNhQbvXIz2ayoij9HYW1q45eqJXSAUZJVjxGhWIsGZqsFrjPsZ +GtzIsmm4564YOoMMqXxQwRwIyyvZqb3YfUV0fGnMNHlUQjt36Wly3Bh/Hegag== From: "Pankaj Raghav (Samsung)" To: Andrew Morton , Jonathan Corbet Cc: linux-kernel@vger.kernel.org, willy@infradead.org, linux-mm@kvack.org, Bagas Sanjaya , David Hildenbrand , da.gomez@kernel.org, mcgrof@kernel.org, gost.dev@samsung.com, linux-doc@vger.kernel.org, kernel@pankajraghav.com, Pankaj Raghav Subject: [PATCH v3] docs: update THP admin guide about non-tmpfs filesystem support Date: Fri, 4 Apr 2025 16:06:57 +0200 Message-ID: <20250404140657.29285-1-kernel@pankajraghav.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 8BB4CA0016 X-Rspamd-Server: rspam05 X-Rspam-User: X-Stat-Signature: rm8zs3qi8oitrrkrr4spuat47n7nrsyb X-HE-Tag: 1743775627-937958 X-HE-Meta: U2FsdGVkX1+JbgiKJ+YO9fI06fVs6HolFKoRBf5sHxdPUV5RsEsdxAYk9xN+8nrWPvtjWcFf0SIGCHTiU634IUp6cv3p9uYw1xeE6gUcRZ377FIn/q3MJzBMTzl9whmeXkWr09kjyDTB4OSDQhk2KEwbYa79pYwt0lrHD72N6Sho3AfI8zqjoo15FoSDEsXfsVsp+RjqBb9cJRJpJnFTmGvs899L0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ests=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: From: Pankaj Raghav THP support for non-tmpfs filesystem has been around for some time now. Update the admin guide to reflect it. While we are at it, move FilePmdMapped to previous paragraph for clarity, and clarify ShmemPmdMapped & ShmemHugePage. Signed-off-by: Pankaj Raghav Acked-by: David Hildenbrand Reviewed-by: Bagas Sanjaya --- Changes since v2: - Address comment from Bagas Sanjaya - Squash commits and Ack from David Documentation/admin-guide/mm/transhuge.rst | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) base-commit: f0a16f5363325cc8d9382471cdc7b654c53254c9 diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst index dff8d5985f0f..f8aae64e38d0 100644 --- a/Documentation/admin-guide/mm/transhuge.rst +++ b/Documentation/admin-guide/mm/transhuge.rst @@ -12,8 +12,8 @@ using huge pages for the backing of virtual memory with huge pages that supports the automatic promotion and demotion of page sizes and without the shortcomings of hugetlbfs. -Currently THP only works for anonymous memory mappings and tmpfs/shmem. -But in the future it can expand to other filesystems. +Currently, THP only works for anonymous memory mappings, tmpfs/shmem and +filesystems that support large folios. .. note:: in the examples below we presume that the basic page size is 4K and @@ -463,11 +463,19 @@ fields for each mapping. (Note that AnonHugePages only applies to traditional PMD-sized THP for historical reasons and should have been called AnonHugePmdMapped). -The number of file transparent huge pages mapped to userspace is available -by reading ShmemPmdMapped and ShmemHugePages fields in ``/proc/meminfo``. -To identify what applications are mapping file transparent huge pages, it -is necessary to read ``/proc/PID/smaps`` and count the FilePmdMapped fields -for each mapping. +The number of PMD-sized transparent huge pages currently used by +filesystem data (page cache) is available by reading the FileHugePages field +in ``/proc/meminfo``. The number of these huge pages that are mapped to userspace +is available by reading FilePmdMapped field in ``proc/meminfo``. To identify +what applications are mapping these huge pages, it is necessary to read +``/proc/PID/smaps`` and count the FilePmdMapped fields for each mapping. + +In similar fashion, the number of PMD-sized transparent huge pages currently +used by tmpfs/shmem is available by reading the ShmemHugePages field +in ``/proc/meminfo``. The number of these huge pages that are mapped to userspace +is available by reading ShmemPmdMapped field in ``proc/meminfo``. To identify +what applications are mapping these huge pages, it is necessary to read +``/proc/PID/smaps`` and count the ShmemPmdMapped fields for each mapping. Note that reading the smaps file is expensive and reading it frequently will incur overhead.