From patchwork Fri Apr 12 07:37:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 13627055 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 A661CC4345F for ; Fri, 12 Apr 2024 07:38:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33C9E6B0092; Fri, 12 Apr 2024 03:38:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C59A6B0093; Fri, 12 Apr 2024 03:38:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F2296B0095; Fri, 12 Apr 2024 03:38:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id DF4F06B0092 for ; Fri, 12 Apr 2024 03:38:18 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7291880DEE for ; Fri, 12 Apr 2024 07:38:18 +0000 (UTC) X-FDA: 82000076676.02.F1BEB31 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf18.hostedemail.com (Postfix) with ESMTP id A07751C000A for ; Fri, 12 Apr 2024 07:38:16 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=mtHZlrQA; spf=pass (imf18.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712907496; 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:dkim-signature; bh=HKv+dOKRCJhG1tenSkeU7/8yjqgzALDAmJSETtZIvnY=; b=XBvTFuZ1dzql/jS03lzpRUxQ7W2utrcQ8CMN6QVPBvxoRGGlVdfsco9yTbLfNwue9nnuaS N+c6tnlaEN/dsW4dlIe14lQY0GwBeMhUVa35xTxnlqvOcn5MKsn/WOEbkhdv7py90/3a1/ wvmGPuQIapNP6BrZ1Anni0IPLJ/z3Qs= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=mtHZlrQA; spf=pass (imf18.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712907496; a=rsa-sha256; cv=none; b=o2X02UDXaX2Lz4BGDCLMh1wCPasid3KO6BGFqevPVCEefM3yIldeVkj0pWGJV5vvRa3TEC HRLda6ssrPIAbpplT7RSyN0UPeWqvdLRl9GkOqJYja4ldDZz93knM9SyEB8dMPmDyCtcQQ ESgYM8XCCh8qmIt4VE0ZsEw1gPIPaQk= Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1e4266673bbso5830625ad.2 for ; Fri, 12 Apr 2024 00:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712907495; x=1713512295; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HKv+dOKRCJhG1tenSkeU7/8yjqgzALDAmJSETtZIvnY=; b=mtHZlrQA/AARalhIGpi81MvEZ4Nzrqj4He5OXUTo7Kg8ujtkPnq3BlwbfZRdrRN8ns wVScXXZd7z8UNSdvdfEFCOf+emZxwSkskMCE9Ojm1dgqlaY0EEAs+7FDnwASyCNZs8HG 9PdUxir2tHruxJgGWgYkzTVWlFsZJ/jZC0W7Ck06H2OE1XdOEdon2ngAWfgPzbKOcisb YHRTpSqupVic4rw4ZGYnL0xF8nq8poPHg1aITdiiytZqMuXqyTep60pOzYbfWbO6nw31 eE4mWrXDWW3ezioGDEnndNnvWiQCnm1x1QBVA5l4n6EXGEh7Tv+P0a/I5vxynD2FlFNE YkuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712907495; x=1713512295; 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=HKv+dOKRCJhG1tenSkeU7/8yjqgzALDAmJSETtZIvnY=; b=TOkkre0LVctMlRhIvcf/cD1gF/ERGfVX1emXYW76Opf8TGJu1eqxIY6Y5Y8nede6m5 eAQVFzVb5vP0RRuiQSxMR3iBjC0yZ80lxM8uASSJQ9iE11OVdpDaxDY+hmfsOBIVnt0M LNlSJ8QkoqyGsshd+YluFS9lU4m3C+IeuRsikzU9Vz9tRhSBzrn26L5s9IgZ8O/aqr6l iCRF+p8vbb7giHE9+cfQMDAoEMmJ8Lmuzef0zBE0t85suKjIIQhZwZV/WpYcupkqchpn edykpYPHd8ifNuYsH/1Kb05AcXZAZFNJt2dBV8MF3Br1boSygwVf8tnQEPT7oskpYbWr K6fw== X-Forwarded-Encrypted: i=1; AJvYcCVUUwQF8aLrJecQapb4ZIph1c+2nqNxoRs5pKiat2i7iZnagfaso5vpXJd75y4d7NS9f2Wmc1OV8EIBhG6MmAyKhE0= X-Gm-Message-State: AOJu0YxLDWT1YrRRHMYlPwot08f2dxEuWFa4rBBFwCTX+ymNwgPI7i9I i/aarlNN0HbsH8VjcGyQDY2v/gFMLmYI1DfuEwBQ0bbajvEtsAPe X-Google-Smtp-Source: AGHT+IEs8mtcjto8rOXz5YMEcwZFJOMI1fiWwDFq30NXF3pGJzIMZvBmCkp2JLPcrzhMVIiefWw4TQ== X-Received: by 2002:a17:902:e950:b0:1e3:e0a7:3c9 with SMTP id b16-20020a170902e95000b001e3e0a703c9mr2171282pll.14.1712907495496; Fri, 12 Apr 2024 00:38:15 -0700 (PDT) Received: from localhost.localdomain ([2407:7000:8942:5500:aaa1:59ff:fe57:eb97]) by smtp.gmail.com with ESMTPSA id n5-20020a170903110500b001e478f359bdsm2344011plh.127.2024.04.12.00.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:38:15 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: akpm@linux-foundation.org, linux-mm@kvack.org Cc: cerasuolodomenico@gmail.com, chrisl@kernel.org, david@redhat.com, kasong@tencent.com, linux-kernel@vger.kernel.org, peterx@redhat.com, ryan.roberts@arm.com, surenb@google.com, v-songbaohua@oppo.com, willy@infradead.org, yosryahmed@google.com, yuzhao@google.com, corbet@lwn.net Subject: [PATCH v5 3/4] mm: add docs for per-order mTHP counters and transhuge_page ABI Date: Fri, 12 Apr 2024 19:37:39 +1200 Message-Id: <20240412073740.294272-4-21cnbao@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240412073740.294272-1-21cnbao@gmail.com> References: <20240412073740.294272-1-21cnbao@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A07751C000A X-Rspam-User: X-Stat-Signature: ttkpt3tgwq7bt19ajn1ymh57uezy9zej X-Rspamd-Server: rspam01 X-HE-Tag: 1712907496-775743 X-HE-Meta: U2FsdGVkX1/dpEBgZGlr/kIU+XbejiHy0d9Uv/3SBi+2g11MstRv/1RKqQFOtA5+XgPVRnNYWieYAysvcgSOQaNZYWjIsl9KYhCLKvFFpnTs2Qss7hoXoxx5aAItfB2vzGBfBHLe+pXiNXVfd8F091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ysdybJ/ezYVvM1VF+m4lcwBQXj+TC3Qvi3Pbq4KREKGKvBPwpPpVZThDKa2TbPm4SyWR1OYCAUgEuQt5qkTrvxBpn3sOrTl8ajkvBO5U0Hvu2UGTcoTKCuVLJ7mSfcCSrvwQGuI8xxVKc9bjIN+bqKQsexMVMSi5UxJUB5iRhoiynK/mzwMxRJQcrq2SLfYaADI7z7T6SCex7BZEhiQ9K+zWCvuXVBql+FUMxw10yzDe9mN0VgWbuZNGtceu1Q7cpjlykJ48hQlcRlDlN6C1YG5prfc69q/SnHkC+ATm3WkQQWNP+RxzVRdcGoApySfA5mYk9ATAHXwmVuWLdJstE864xf59Tit9RUvdQS3Tf/00TlZ56iq4tAbO56g3K5x/sPNkhJY18BlFSgtpvYK1DpTQFnywfUDb46IBIHO4JzmNFRAPH+LToN9woCfQTf2+vvhExTf+cD7Sg8WYdoAMZpfH/WF+Ynk4hZubabZ1BLNzPx1tuvt5AWoERy2Y4nzImfi1IMdDbKYjyjXtJ3+JONu6lqUJN8Qzbh06NUMzYnQYhldhS11Xxh1hkCLWwTlCTb0tvBkXcY/oBapW5swCSUaSsZAPjh6E5fNz1HEgAzIEz0lbS4zzHPBw6UM+7tFU4zODAMLm4NeAyv8OcB1QzjeFkjkDLDz8GarKAcQkHB1UeVwwV4= 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: From: Barry Song This patch includes documentation for mTHP counters and an ABI file for sys-kernel-mm-transparent-hugepage, which appears to have been missing for some time. Signed-off-by: Barry Song Cc: Chris Li Cc: David Hildenbrand Cc: Domenico Cerasuolo Cc: Kairui Song Cc: Matthew Wilcox (Oracle) Cc: Peter Xu Cc: Ryan Roberts Cc: Suren Baghdasaryan Cc: Yosry Ahmed Cc: Yu Zhao Cc: Jonathan Corbet Reviewed-by: Ryan Roberts --- .../sys-kernel-mm-transparent-hugepage | 17 +++++++++++ Documentation/admin-guide/mm/transhuge.rst | 28 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Documentation/ABI/testing/sys-kernel-mm-transparent-hugepage diff --git a/Documentation/ABI/testing/sys-kernel-mm-transparent-hugepage b/Documentation/ABI/testing/sys-kernel-mm-transparent-hugepage new file mode 100644 index 000000000000..80dde0fd576c --- /dev/null +++ b/Documentation/ABI/testing/sys-kernel-mm-transparent-hugepage @@ -0,0 +1,17 @@ +What: /sys/kernel/mm/hugepages/ +Date: April 2024 +Contact: Barry Song +Description: + /sys/kernel/mm/transparent_hugepage/ contains a number of files and + subdirectories, + - defrag + - enabled + - hpage_pmd_size + - khugepaged + - shmem_enabled + - use_zero_page + - subdirectories of the form hugepages-kB, where + is the page size of the hugepages supported by the kernel/CPU + combination. + + See Documentation/admin-guide/mm/transhuge.rst for details. diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst index 04eb45a2f940..f436ff982f22 100644 --- a/Documentation/admin-guide/mm/transhuge.rst +++ b/Documentation/admin-guide/mm/transhuge.rst @@ -447,6 +447,34 @@ thp_swpout_fallback Usually because failed to allocate some continuous swap space for the huge page. +In /sys/kernel/mm/transparent_hugepage/hugepages-kB/stats, There are +also individual counters for each huge page size, which can be utilized to +monitor the system's effectiveness in providing huge pages for usage. Each +counter has its own corresponding file. + +anon_fault_alloc + is incremented every time a huge page is successfully + allocated and charged to handle a page fault. + +anon_fault_fallback + is incremented if a page fault fails to allocate or charge + a huge page and instead falls back to using huge pages with + lower orders or small pages. + +anon_fault_fallback_charge + is incremented if a page fault fails to charge a huge page and + instead falls back to using huge pages with lower orders or + small pages even though the allocation was successful. + +anon_swpout + is incremented every time a huge page is swapout in one + piece without splitting. + +anon_swpout_fallback + is incremented if a huge page has to be split before swapout. + Usually because failed to allocate some continuous swap space + for the huge page. + As the system ages, allocating huge pages may be expensive as the system uses memory compaction to copy data around memory to free a huge page for use. There are some counters in ``/proc/vmstat`` to help