From patchwork Tue Oct 10 14:27:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 13415652 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 1FB19CD8C8B for ; Tue, 10 Oct 2023 14:29:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5F888D00BB; Tue, 10 Oct 2023 10:29:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE84D8D0002; Tue, 10 Oct 2023 10:29:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98A548D00BB; Tue, 10 Oct 2023 10:29:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7A32E8D0002 for ; Tue, 10 Oct 2023 10:29:31 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 342121A0199 for ; Tue, 10 Oct 2023 14:29:31 +0000 (UTC) X-FDA: 81329784942.14.0E68D8E Received: from out-200.mta0.migadu.com (out-200.mta0.migadu.com [91.218.175.200]) by imf21.hostedemail.com (Postfix) with ESMTP id 870CF1C002E for ; Tue, 10 Oct 2023 14:28:48 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=YUXjCIGK; spf=pass (imf21.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 91.218.175.200 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696948128; 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=lBUz50yRXYSwkMpVqbF4xKRgGKpQYvwhtcgTljx7wmY=; b=st4UQvhA01KsCFjK2pX3YRK9WCagqIfLkKlFGWl5dAI/W711jQ8qoeOxPTYrCS2UeENpCe GyKYh2gBgLXTjk/KJwey3ylChTqqEW2wY9H6yv5PBJGYaGgwvVkHihd7aOPk22UnYAOdzn dZi53/eQzhSCqwvPUbpLUNueUjQaqzM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696948128; a=rsa-sha256; cv=none; b=sTVbEuQshtuuFcToULnTeV7cZRbULscQ6I0hBfoKYte9GIIyD1qZssbTLFXqs1jPlEKrDS syf5xQICyQCyqwNdBI6yXIJp2aIclwLMbQZ71/qomLz/0OoqWgEldX7qon5rMDn6VfBnt/ DLRFpbytdMZ/UbRxFvztMtqs+HcabIw= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=YUXjCIGK; spf=pass (imf21.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 91.218.175.200 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1696948127; 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: in-reply-to:in-reply-to:references:references; bh=lBUz50yRXYSwkMpVqbF4xKRgGKpQYvwhtcgTljx7wmY=; b=YUXjCIGKTxNpExiRwy5wj5HYemZEfcJ9ufogB+8cHg/UjkS0SCbQYARvOV3YrvQJ8h+xbz Th5rey7xD3OZISdwToRtGiUKbk9WRMhfP9YBFG3zk/ZKVyPJvSt0FCzAdLhCmhLVFpVm/Q O+0tz8vCi9Sa5w73oy9N7qPq9/zVhQ8= From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , Matthew Wilcox , David Hildenbrand , "Kirill A. Shutemov" , Mike Kravetz , Miaohe Lin , Vlastimil Babka , Muchun Song , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: [PATCH v1 1/5] include/uapi/linux/kernel-page-flags.h: define KPF_FOLIO Date: Tue, 10 Oct 2023 23:27:57 +0900 Message-Id: <20231010142801.3780917-2-naoya.horiguchi@linux.dev> In-Reply-To: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> References: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 870CF1C002E X-Rspam-User: X-Stat-Signature: opji78a7hzmi6u3ha1ckfpe5eaezjh9o X-Rspamd-Server: rspam03 X-HE-Tag: 1696948128-123678 X-HE-Meta: U2FsdGVkX1+ffCN8z97UOMNGWGOE6wpkUkHVR0C9viaqCl/w2rb4h205daZk82wGE5+zFdIujHxzm6ADQ6L2n4woZoBBPpuAphX24xIsyEOtKjt+x+cT67JdjMzu94tFH12rywpdQAwqUyKtTKwyloPWhmcFXlWLU2R3kBOjHdABoiPhsBSKiZEtVIqrOTKeg/ptnQxGwg5WWtgL6WY3QEmuOBGmJLgCplv0xjzhqdCaJzXxb4uGT1uPBRCEtd6LXLhY9XcRL34hpGLXZ1I3MRN1G3nYAQQuRcsz7GOYj3AmKQcX1KUlkSBE2TIoxijDOHK6B+wkw5wNh3asbf6QhihFJ/kO+VsWLQBUkz7iWOd8c6atzy4tJTGbnTz5jPAQusSHaYXKs5emV1m5Puxs/f2ImKjqN3zIYidOBFRMCUpk+lmHMCi0Cq2nN6KEHKJju8O+TI1Ao28ymeD5TPshiXq7DNffdKLLfBVppX3vm2cT4lYZr1d9e1WnPJAI+Hozei6UfDk9IUqMUNu274cvP/poLsFtcB2E0AxKn26cFfJtpGY/vbuqEDrJY24Jginb/Yg641pRHz+WEX6qUrTtYhNLcoUs4ON0ZGE9znn5RL8ivCLBrsoNwNucjYZYDotPukSuUvl+R0NdkV3SvWgMTXHbDnkmdbfYMQU25suadsl53DIMrACnxCiRVvK7WkaexJU3OYa0nxmFSU6zfXrYbYsxVCi4aT9F9NOpoT53+gKHTOiN98bC1z2otByEEDsbm1pN/JfongmkTQCVfyuLcL7Inskx7gwg+GxoUeYKfQpMX7TyYupI8DA5AApDAytPuE5gm1IzAZxIJy7BJYbrjef6DWFE4wA0tZHnJ76Okwj0+JvRUeh0HnuJtRf7NQDGpTGaMQJFZN6Q8B531znMrqCFAASlMHO0JVTB/jJ85cdb8px5XIhY2yRg4pWEaIcODzA0jnPEm6FaOXXkKk2 2qZCdlaH SLvCD9mBybSpTSBqvFhFwvtSt9DOh3ym7dNSrws7Lbrxoe3yxOiJ2Cyjcos+07qdCUSXsYjDlvnIZvLIsl/hvtuSvpAx5Qtwt/VbHUU49jaoXxEolfFLsS+9kD5NCZI9jsh4NQ9IlT9VJ7XM= 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: From: Naoya Horiguchi Define a new KPF flag to represent folio in /proc/kpageflags and in-kernel user page-types.c. Note that in page-types.c I chose 'f' for the character representing folio, which conflicts with KPF_SOFTDIRTY, but we have no other choice because all reasonable choices ('f', 'F', 'o', 'O', 'l', 'L', 'i', and 'I') are already used. You need to pay attention to long flag names or the position of 'f' in short form. Signed-off-by: Naoya Horiguchi --- include/uapi/linux/kernel-page-flags.h | 1 + tools/mm/page-types.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h index 6f2f2720f3ac..9b43dadb7f49 100644 --- a/include/uapi/linux/kernel-page-flags.h +++ b/include/uapi/linux/kernel-page-flags.h @@ -36,5 +36,6 @@ #define KPF_ZERO_PAGE 24 #define KPF_IDLE 25 #define KPF_PGTABLE 26 +#define KPF_FOLIO 27 #endif /* _UAPILINUX_KERNEL_PAGE_FLAGS_H */ diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c index 8d5595b6c59f..b78448d19e88 100644 --- a/tools/mm/page-types.c +++ b/tools/mm/page-types.c @@ -126,6 +126,7 @@ static const char * const page_flag_names[] = { [KPF_PGTABLE] = "g:pgtable", [KPF_ZERO_PAGE] = "z:zero_page", [KPF_IDLE] = "i:idle_page", + [KPF_FOLIO] = "f:folio", [KPF_RESERVED] = "r:reserved", [KPF_MLOCKED] = "m:mlocked", From patchwork Tue Oct 10 14:27:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 13415667 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 A0639CD8C91 for ; Tue, 10 Oct 2023 14:33:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 323EB8D00BD; Tue, 10 Oct 2023 10:33:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D4738D0002; Tue, 10 Oct 2023 10:33:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C2E48D00BD; Tue, 10 Oct 2023 10:33:13 -0400 (EDT) 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 055068D0002 for ; Tue, 10 Oct 2023 10:33:13 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 753341CA6B5 for ; Tue, 10 Oct 2023 14:33:12 +0000 (UTC) X-FDA: 81329794224.04.91CEFA0 Received: from out-192.mta0.migadu.com (out-192.mta0.migadu.com [91.218.175.192]) by imf10.hostedemail.com (Postfix) with ESMTP id D878FC0379 for ; Tue, 10 Oct 2023 14:28:52 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="bpjtc/LF"; spf=pass (imf10.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 91.218.175.192 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696948133; 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=ct5h8XiEF6Z6bh0u0KQdOShLvibauoLK/pnF+aCIbHs=; b=HtPD20XxhBwQC01li0yHFhtFleEWhjWyKnChInV8xOGWlBHmyiJHJlJhhIkYQCDAuDOch3 WgeN0ytkry2XeVBB0FcOChb20rGnvybSOJyrEt8NCgDMI33rAJlCSMTxuGgS8qxyWCrLHC 4shn2tjmf0kW5GrTuCt22FRsG5xSr+w= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696948133; a=rsa-sha256; cv=none; b=mcVoAf7kHTYkQ/5GvAcZILaKPT5qA0zViTtdTw20KAxRolMXwp0iwd8yYnjPupm1GqKQ9b AVq1eYly8QC59NjyNB398OBMWaEf06+utPVoP27OKnjiX//dn/IV7fFEhl3Jq5e0/0T+t0 +xUsUiB6CPTOh0f7qUP5uoAMFRLhjBU= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="bpjtc/LF"; spf=pass (imf10.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 91.218.175.192 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1696948131; 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: in-reply-to:in-reply-to:references:references; bh=ct5h8XiEF6Z6bh0u0KQdOShLvibauoLK/pnF+aCIbHs=; b=bpjtc/LFwjIYuknqBdChdrg6pH5LhH0gERemOAwGNiqO/B0yhaIPcKkXhCyk1Y+6QiAB6D pdmVPLFHqF8iWcxI7QpWy2AkvCdR7eOxKKaViIq1Qya/PPl2bRQHZMcyklBZ8+34tDxuvO QoG/rGqvVIFHC+5eFcdEu8fJDv1/1Hs= From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , Matthew Wilcox , David Hildenbrand , "Kirill A. Shutemov" , Mike Kravetz , Miaohe Lin , Vlastimil Babka , Muchun Song , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: [PATCH v1 2/5] mm: kpageflags: distinguish thp and folio Date: Tue, 10 Oct 2023 23:27:58 +0900 Message-Id: <20231010142801.3780917-3-naoya.horiguchi@linux.dev> In-Reply-To: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> References: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: D878FC0379 X-Rspam-User: X-Stat-Signature: gtqf63ibwqur6d75dc1sbh9nc48nwre7 X-Rspamd-Server: rspam03 X-HE-Tag: 1696948132-238300 X-HE-Meta: U2FsdGVkX188f+PjL2PQPkp+h2DPL53X47CEvIJJv+GxId20CASTcBVxXcdFj4ExwfdYPDY5fL5VSO3XOZNw+jo9BuxloHrgfiQbsQ6bPNSVOwudd1ESTB3d9jGEaRnsjbZ39q7BYA4qwjMbcnGiWU4L20zYdopyPpZscpvWdiLwp/sBUIPvRL5/yEo8ycX/Rv8oGYmIF0M2dm5P1FmdqBms//DDtMbEhEeaHxrWNC/A91thma8wQEUS+Gxs83tubljUojHRO1VtDLat0iP2Y+z3PeqaGFpAbrne6EuGUrozmbk6K8LQaTTzHhxD6RWQdxwLW+wSK3vaddE8FxybkZ/3m7whsNI/7RG4oNKZN+VndMK2FYE+eudO5fKGxGKW3R6w63rujMRMcFI/qkbO/hEgTVgDjGJsi4IRjUDyqIsKQLpSk4JHQUf7sgPxlJ+b+GtmFstSVA0PK49cN0ljug+GhCbliLVEAM8ZB25Us/ro0ezzJDrsiLuW/c4oXxISKhab2M2IPDrokpzTrT3UXXiXC50H/khuDju7GaMGvFTm3ph/Hg/86bfOgvbnWeRiKDzcdVXdPld66+GgJw9XInNpjuzewHlQdfcIkUeOk6Jbok/jN84I6W39703quUuGJB2UP6e8ppo2MYtrIbcPpdemwFkmpoZklzqjOmdteXCUFYw0PgXPXes9GxJJVHhSGejSvZRCIH7NBBTZ31DsZexlCzckywIYxLbpdBa7dPwAwnpI6+haQhiOwyUQTSvm5JqP0/nyTrGU3C6d9hWiyj7OZ8QRWLtBI8MslgBMTyGXhnAMm6CQEbzwT0y5itZAt1KhJK6Xqltjm/VaCuSAknJloLUuCo7Dyl43lB4jdEp/+5TGNVDve5/okJEbMhiIv1x/Zoii3M6/apgHQ4Ta+1nM2UHkn2skbcu8AdXI+0ozVlxTKfZi8WNjEE6VBgfmlGZ2G5OxtemYYTGiNxq VcjtU3eF Na2lVO/7D5OWws8GAJmp5eHpkmrObR1pvljpz5TVi239ynjDAxxj3dEqwv3yLKgI+EQNZif2EyfUPFgqyd5Ndh1Jo0g== 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: From: Naoya Horiguchi Currently a large folio is considered as thp in the output of /proc/kpageflags because stable_page_flags() does not have resolution to distinguish thp and large folio. This is confusing and the readers of /proc/kpageflags need additional checks in userspace, which is inefficient. Check page order in stable_page_flags() to distinguish thp and large folio. Although thp (or other types of compound page) is a special form of folio, but the KPF_FOLIO means "folio" in narrower meaning (representing folios in page cache), so KPF_FOLIO is not set on thp or hugetlb pages. This is because thp and hugetlb (and other compound pages) have their own KPF_* flags, so those are already identifiable. Thp and folio use some struct page's field of the first tail pages for internal use. There's no point to parse and show flag info based on tail pages, so return immediately when finding thp/folio tail pages. The output below shows how this patch changes the output of page-types. Before patch: // anonymous thp voffset offset len flags ... 700000000 156c00 1 ___U_l_____Ma_bH______t_____________f_d_____1 700000001 156c01 1 L__U_______Ma___T_____t_____________f_______1 700000002 156c02 1fe ___________Ma___T_____t_____________f_______1 ^ this 't' means thp // file thp 700000000 15d600 1 __RUDl_____M__bH______t_____________f__I____1 700000001 15d601 1 L__U_______M____T_____t_____________f_______1 700000002 15d602 1fe ___________M____T_____t_____________f_______1 // large folio 700000000 154f84 1 __RU_l_____M___H______t________P____f_____F_1 700000001 154f85 1 ________W__M____T_____t_____________f_____F_1 700000002 154f86 2 ___________M____T_____t_____________f_____F_1 After patch: // anonymous thp 700000000 117000 1 ___U_l_____Ma_bH______t_____________f_d_____1 700000001 117001 1ff ________________T_____t_____________f_______1 // file thp 700000000 118400 1 __RUDl_____M__bH______t_____________f__I____1 700000001 118401 1ff ________________T_____t_____________f_______1 // large folio 700000000 148da4 1 __RU_l_____M___H___________f___P____f_____F_1 700000001 148da5 3 ________________T__________f________f_____F_1 ^ this 'f' means folio Signed-off-by: Naoya Horiguchi --- fs/proc/page.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/fs/proc/page.c b/fs/proc/page.c index 195b077c0fac..78f675f791c1 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -154,11 +154,24 @@ u64 stable_page_flags(struct page *page) else if (PageTransCompound(page)) { struct page *head = compound_head(page); - if (PageLRU(head) || PageAnon(head)) - u |= 1 << KPF_THP; - else if (is_huge_zero_page(head)) { + /* + * We need to check PageLRU/PageAnon to make sure a given page + * is a thp, not a huge zero page or a generic compound page + * (allocated by drivers with __GFP_COMP). + */ + if (PageLRU(head) || PageAnon(head)) { + if (compound_order(head) == HPAGE_PMD_ORDER) + u |= 1 << KPF_THP; + else + u |= 1 << KPF_FOLIO; + } else if (is_huge_zero_page(head)) u |= 1 << KPF_ZERO_PAGE; - u |= 1 << KPF_THP; + + if (PageHead(page)) + u |= 1 << KPF_COMPOUND_HEAD; + if (PageTail(page)) { + u |= 1 << KPF_COMPOUND_TAIL; + return u; } } else if (is_zero_pfn(page_to_pfn(page))) u |= 1 << KPF_ZERO_PAGE; From patchwork Tue Oct 10 14:27:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 13415664 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 CE530CD8C8B for ; Tue, 10 Oct 2023 14:29:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2377F8E000A; Tue, 10 Oct 2023 10:29:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C19E8D0002; Tue, 10 Oct 2023 10:29:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 03AED8E000A; Tue, 10 Oct 2023 10:29:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D70B68D0002 for ; Tue, 10 Oct 2023 10:29:34 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7BC39B4A6A for ; Tue, 10 Oct 2023 14:29:34 +0000 (UTC) X-FDA: 81329785068.13.9D11A5B Received: from out-210.mta0.migadu.com (out-210.mta0.migadu.com [91.218.175.210]) by imf26.hostedemail.com (Postfix) with ESMTP id 08A231400AA for ; Tue, 10 Oct 2023 14:28:56 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FLuxcLJc; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf26.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 91.218.175.210 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696948137; 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=/jN8h55KNP3RtmvUZhOGO1MAcrm7V1DX54vKKCbAGW4=; b=d0Ej1yxnY/hKLX+p2l56qAWgSKEEDmBtDgIR8KopfpYqfXZVyvjnU/4KUEaG9JV9Nxa7he HcFasElN/LXbJesE4+MqeidBzeQroD/4mE6eq98G5zyQaV9nMlfUDMf3MaM4Qb/3s4Ek/+ cUgHKjmXv8dYlOfOO8JpXZpvj74E8ng= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FLuxcLJc; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf26.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 91.218.175.210 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696948137; a=rsa-sha256; cv=none; b=JJ81tqMYAJoqU7qhwiM50F6DeeLp/AOvcBr6ngGDlZbpowprlpdKfpXttIqGsXXtAN1dbb XH6xaRLUO9bWD67H1vLQjW68DnipgVnR2pvoZK8Rzw1B8Cvi19Kv8t5kFUkAPtXlVwuanB rVyl0vOVOHdEEJ/inevAw1kCC3gGhPw= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1696948135; 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: in-reply-to:in-reply-to:references:references; bh=/jN8h55KNP3RtmvUZhOGO1MAcrm7V1DX54vKKCbAGW4=; b=FLuxcLJc7MCThBfukRGPV/s0DkOpYhPtv8G1oc+pjfFNMFlePzS1gd3bcdx3OjEWEtwW79 Y93/hs4sGbhOPLdoBK9ceAD39O+cKFKsl5IBEFQ7Vu0D4I1DeN5FK3Bj6lQjjmpW2x8c+Z HfvyEq0sy9NhAJKbfwL6i2M897zQLx4= From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , Matthew Wilcox , David Hildenbrand , "Kirill A. Shutemov" , Mike Kravetz , Miaohe Lin , Vlastimil Babka , Muchun Song , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: [PATCH v1 3/5] mm, kpageflags: separate code path for hugetlb pages Date: Tue, 10 Oct 2023 23:27:59 +0900 Message-Id: <20231010142801.3780917-4-naoya.horiguchi@linux.dev> In-Reply-To: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> References: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 08A231400AA X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: neycbx4a1gr7b1z9o9zymzh7pazpru3t X-HE-Tag: 1696948136-538576 X-HE-Meta: U2FsdGVkX1+C7JdBncRYQ85KVYtumOCgfAlbY1/aSSWMC/2kSU+G8aHASUBY1otcfTUYizFADtcda/Fu4jFEHdUDjuRdn1AF0K2bG1/GQbZeXCHq5I/fbfckdWV11j0tF/5NJ9j28DCriu4rp/M21Gv8AgqPWSA/HQprDsropMB/twwt8KzX6o8x6E9OrimNsQvpLOJwI8Fnh201hMHqU62VCvcR4Whiu2sSSn8ZemLN6V9GdHdPgzoBCUx35KIQDluHCFQ0eCUrxuzcMmRJ/Z+SMaF1aHvtDBtUTVtJ3WOKKXU1oV5gqsL2wrIfEdEfTKecAs83TL2oRpjkyayO2J2HIPZJot1rX0OIaDVNyCN5C1KQkLs0YB4zHA0KZXpZGSP5Id8vObc3aceeyS3XkAr8xeEQcKHrgikriCWDZOQRsFKt4peIINDQwbiwVwWCAsZf2B2SDR77k+mImkY0t06Pk1GfCawe5DuL0A76qhgZH1fgE6/+BjIcxtHbAZuziDL2Ht3HOkgz3QMmheJc8dWo188LNzbgx/1/R382y1T5SxCjNkpwwcnVQSvFltafHvJ9SjdFrMftcBJRhKgT1G/uXFQZaPr3eMGrJga2+f0NeLZeMWFdAK3ztjHjWqoYjnNl/u6r4seEO0/guJWyI+9a7AYCcK6qS+LHctmu7SzfO6RNSFbMr/+emOtvMrOgBFCxZ0EjVdRL3Xx5rwqfauYt3391S2/17x4G8ytx1enGzIh9jrS/erxkJC5ND3qjEnmtIcmia0K03Qtnd3bsWFymTA4S8NiJRHnVEbqLmE5f5N2b1sHsm26kIIjSS1lazWmBPLWsrdp0BfM3bNe4aNgJy1omScOcfQJ4YigRmOHnd7JY9vGcYAedoouvrerRY2Zbwi/r8PxFPQG8alAXmVOyvTeJtdsXbU4WgV/UBK8gnoe2huP9y08Y4SxtL3rpqWsg3/mn8Z3plEK905u 52ImcGYs vAIMygxePXQ6arHbw5l4xLZrmRuLqzzLFqpGk1YM7ZZAMjiusmfcdv1nESETI3P6s+z2BPvusXy2EWIbbN26MMYTp9iikmuowMYcO 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: From: Naoya Horiguchi Hugetlb pages use some struct page's field of the first few tail pages for internal use. There's no point to parse and show the kpageflags info based on tail pages, so return immediately when finding hugetlb tail pages. Signed-off-by: Naoya Horiguchi --- fs/proc/page.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/fs/proc/page.c b/fs/proc/page.c index 78f675f791c1..9b6ded8a2c90 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -135,23 +135,20 @@ u64 stable_page_flags(struct page *page) if (PageKsm(page)) u |= 1 << KPF_KSM; - /* - * compound pages: export both head/tail info - * they together define a compound page's start/end pos and order - */ - if (PageHead(page)) - u |= 1 << KPF_COMPOUND_HEAD; - if (PageTail(page)) - u |= 1 << KPF_COMPOUND_TAIL; - if (PageHuge(page)) + if (PageHuge(page)) { u |= 1 << KPF_HUGE; + if (PageHead(page)) + u |= 1 << KPF_COMPOUND_HEAD; + if (PageTail(page)) { + u |= 1 << KPF_COMPOUND_TAIL; + return u; + } /* - * PageTransCompound can be true for non-huge compound pages (slab - * pages or pages allocated by drivers with __GFP_COMP) because it - * just checks PG_head/PG_tail, so we need to check PageLRU/PageAnon - * to make sure a given page is a thp, not a non-huge compound page. + * PageTransCompound can be true for any types of compound pages, + * because it just checks PG_head and PageTail, but at this point + * PageSlab and PageHuge are already checked to be false. */ - else if (PageTransCompound(page)) { + } else if (PageTransCompound(page)) { struct page *head = compound_head(page); /* From patchwork Tue Oct 10 14:28:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 13415665 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 55AD3CD8C8B for ; Tue, 10 Oct 2023 14:30:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E46848D00B4; Tue, 10 Oct 2023 10:30:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DCF138D0002; Tue, 10 Oct 2023 10:30:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C703E8D00B4; Tue, 10 Oct 2023 10:30:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B4E0B8D0002 for ; Tue, 10 Oct 2023 10:30:21 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 87C61B4A5B for ; Tue, 10 Oct 2023 14:30:21 +0000 (UTC) X-FDA: 81329787042.01.9DE1C0E Received: from out-198.mta0.migadu.com (out-198.mta0.migadu.com [91.218.175.198]) by imf23.hostedemail.com (Postfix) with ESMTP id 47397140007 for ; Tue, 10 Oct 2023 14:29:00 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=LGQ17jWA; spf=pass (imf23.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 91.218.175.198 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696948141; 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=8iM6qPUOV4SzLi4G7vOLG6YfwWxmIMlrGIRntMRiEaw=; b=aGJjxkMolLdj+9vSeh4uxAJXSKMlqZFg7xEvDN3BmM7Sg8B/fawS6Mbo7dI9+JDf5YprJI nCAO3rzol6OActkEt9QMxaIbx6yVAk+lHPCcEeBTA0mp7tp6pKd48IJGTtlrURc9c/MF5e v/5z4jA6oOqBA3h2VdHpxO60YBD5pUc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696948141; a=rsa-sha256; cv=none; b=Zw19NDxB+3hGR5TXyAkMHRZ0jOl27dnEvaiToYHUgSQfVYDMOa4uKD9qS7OhF6gzL1K19r BuQR6U/JJkLd/4XzjGOAh6p8PvjD6Xid3L2QW9ahPqgQ8QiOqi9aWQgILch81HL9+LgdKX ZT7AveV8kFxXFSKm1pm4tkUsJx+LxI4= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=LGQ17jWA; spf=pass (imf23.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 91.218.175.198 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1696948139; 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: in-reply-to:in-reply-to:references:references; bh=8iM6qPUOV4SzLi4G7vOLG6YfwWxmIMlrGIRntMRiEaw=; b=LGQ17jWAmO3AzMTEsiisqBbOeFYutV+KmHjON926qys/pAgpt4siIMYDJofdhHOETudxF3 D4Y7Fa+Xzgy6CTNCoSSFTQWg1Owoi4swnyZrRm/n404f16vqJBzEonrBhPIQKvt0miTdvg JaSCNdpTWTvdYNouWp5c6jdVh0y3xac= From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , Matthew Wilcox , David Hildenbrand , "Kirill A. Shutemov" , Mike Kravetz , Miaohe Lin , Vlastimil Babka , Muchun Song , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: [PATCH v1 4/5] mm, kpageflags: fix invalid output for PageSlab Date: Tue, 10 Oct 2023 23:28:00 +0900 Message-Id: <20231010142801.3780917-5-naoya.horiguchi@linux.dev> In-Reply-To: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> References: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 47397140007 X-Rspam-User: X-Stat-Signature: 7dzoyhc4io6pm9htmru4b8syjkcq5d7o X-Rspamd-Server: rspam03 X-HE-Tag: 1696948140-228843 X-HE-Meta: U2FsdGVkX1/GNOCixeqk1t40qV7Jdq2G8TD4JCOsXyWef6tRR1b5mdkkmRehWfMWqIOdE7pNz1X+zEUps5fjAADQcbvK7Ly6RhM8GTzPB8Dtap5AhQ3v9PGAPjw8oVhJonB3Nh84mDbDU01gQKQuW9jgNqcXC2FN29yjyFPCCZ7fnfA/hS8gV7P30qFUYagwjQ5UlBcYjIw7Agc/LZxt4W3+CizJK6MPh1QEuxgKj4GRhoQk5HuDx0DHq1ZVOgZpnbWISEFqPOhU6Ofz6xDNfG7sDGfZOmfEmQgpVOAzKXTTthDQIP7HOBphoYjDJ0A8YbCYe/baXJ3p4ajPZ4jMHoJq7ahuzS+m2uoqOX9eDt7NompE+b4h1+IqiX4yeSSCrak/k0u1sX5VUMos6ezUGsYb3hymriSYxOSDJXZWzMB9bvr7fd2lfTmbCsfaYPAfT1tiWqtWhSeeLAGVd7QMnIHKaFVbWlAHOzcfBdC+e4YVkjvDkCc8Nc1U9/1WIfMpZEHc4+uEt1xITrIT7u3eDgB8cnm3AykuT2NJIjEeLvBx6Z0pJUyuO/SziYazdUAchWPhB2spQXc342Q6hBO/ujcaSOl3yIiW3h45Nq3LW6wS7U+kiouKrNTcBGvj0CgLAONC7YSpLCT3XgNvwURnKgWQRIjJ36PvdmWVD08PhyWvA8Tv9/zDj/wIi4xNPA9OY22pe6WGPuQFa+IwA9q7aWtMSoMF54ZP5iSoyid0pc7Angg7GSiOwkLsJ/FjzMSUIf89MD1vo8X0GHO5LloGEzBHxn2R5DrxmXBKnZ4TusXyYoIxQPktpnA2b0XdTKs01+5sG+yiDfmGIBqBL7wS+VlyaUB4CZwtvz3S5CDE6IgixceGN/sDL/lRF3cnq28rMxDv9ZYuLgDErL/GHLaKGD9tGQJoY8ZVMK+WqVFx1LMty7av0Mx14nOm0BMZW7J0DtKt3V9SiUJMptI9cgc bwtQXXoI HBwDbbyjW1UnSXCEV6UmZZ3BrH2+ZIVfQLvSorg5fZlvegH/pC19xx0W5tvqgFYwGkDVZo7VzOmcTLgzsFUlOuMowg3AJcdXcCFM1xuHeTjC2eY4= 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: From: Naoya Horiguchi The flag field of slab tail pages is used for internal purpose and there's no point in exposing such info to userspace. Here's the output of `page-types -r -b slab` command now: flags page-count MB symbolic-flags long-symbolic-flags 0x0000000000000080 5304 20 _______S_____________________________________ slab 0x0000000000008080 1488 5 _______S_______H_____________________________ slab,compound_head 0x0000000000010081 365 1 L______S________T____________________________ locked,slab,compound_tail 0x0000000000010080 4142 16 _______S________T____________________________ slab,compound_tail 0x0000000000010180 649 2 _______SW_______T____________________________ slab,writeback,compound_tail 0x0000000000010181 474 1 L______SW_______T____________________________ locked,slab,writeback,compound_tail 0x0000000000201080 192 0 _______S____a________x_______________________ slab,anonymous,ksm 0x0000000000001080 427 1 _______S____a________________________________ slab,anonymous 0x0000000000409080 237 0 _______S____a__H______t______________________ slab,anonymous,compound_head,thp 0x0000000000411081 78 0 L______S____a___T_____t______________________ locked,slab,anonymous,compound_tail,thp 0x0000000000609080 77 0 _______S____a__H_____xt______________________ slab,anonymous,compound_head,ksm,thp 0x0000000000611081 32 0 L______S____a___T____xt______________________ locked,slab,anonymous,compound_tail,ksm,thp 0x0000000000411080 698 2 _______S____a___T_____t______________________ slab,anonymous,compound_tail,thp 0x0000000000611080 142 0 _______S____a___T____xt______________________ slab,anonymous,compound_tail,ksm,thp 0x0000000000611180 32 0 _______SW___a___T____xt______________________ slab,writeback,anonymous,compound_tail,ksm,thp 0x0000000000411181 95 0 L______SW___a___T_____t______________________ locked,slab,writeback,anonymous,compound_tail,thp 0x0000000000411180 64 0 _______SW___a___T_____t______________________ slab,writeback,anonymous,compound_tail,thp 0x0000000000611181 13 0 L______SW___a___T____xt______________________ locked,slab,writeback,anonymous,compound_tail,ksm,thp In this output, "locked" and "writeback" flags are completely pointless because these are encoded in folio->_flags_1 via folio_set_order() and those pages are actually not locked nor written back. As for "anonymous" and "ksm" flags, these are encoded in folio->mapping and the actual value is like 0xdead000000000003. I'm not sure how this value is set, but according to the comment in include/linux/page-flags.h: > * For slab pages, since slab reuses the bits in struct page to store its > * internal states, the page->mapping does not exist as such, nor do these > * flags below. So in order to avoid testing non-existent bits, please > * make sure that PageSlab(page) actually evaluates to false before calling > * the following functions (e.g., PageAnon). See mm/slab.h. , so we don't have to check PageAnon and PageKsm for slab pages. So return immediately when finding slab tail pages. Note that KPF_HWPOISON is special and it can be helpful to make it visible in /prock/kpageflag even on compound tail pages. After this patch, `page-types -r -b slab` command shows the following simpler output (without any invalid flags). 0x0000000000000080 5659 22 _______S_____________________________________ slab 0x0000000000008080 1644 6 _______S_______H_____________________________ slab,compound_head 0x0000000000010080 6196 24 _______S________T____________________________ slab,compound_tail Signed-off-by: Naoya Horiguchi --- fs/proc/page.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/fs/proc/page.c b/fs/proc/page.c index 9b6ded8a2c90..899b96a26fbd 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -122,18 +122,18 @@ u64 stable_page_flags(struct page *page) k = page->flags; u = 0; - /* - * pseudo flags for the well known (anonymous) memory mapped pages - * - * Note that page->_mapcount is overloaded in SLAB, so the - * simple test in page_mapped() is not enough. - */ - if (!PageSlab(page) && page_mapped(page)) - u |= 1 << KPF_MMAP; - if (PageAnon(page)) - u |= 1 << KPF_ANON; - if (PageKsm(page)) - u |= 1 << KPF_KSM; +#ifdef CONFIG_MEMORY_FAILURE + u |= kpf_copy_bit(k, KPF_HWPOISON, PG_hwpoison); +#endif + + if (PageSlab(page)) { + u |= 1 << KPF_SLAB; + if (PageHead(page)) + u |= 1 << KPF_COMPOUND_HEAD; + if (PageTail(page)) + u |= 1 << KPF_COMPOUND_TAIL; + return u; + } if (PageHuge(page)) { u |= 1 << KPF_HUGE; @@ -173,9 +173,18 @@ u64 stable_page_flags(struct page *page) } else if (is_zero_pfn(page_to_pfn(page))) u |= 1 << KPF_ZERO_PAGE; + /* + * pseudo flags for the well known (anonymous) memory mapped pages + */ + if (page_mapped(page)) + u |= 1 << KPF_MMAP; + if (PageAnon(page)) + u |= 1 << KPF_ANON; + if (PageKsm(page)) + u |= 1 << KPF_KSM; /* - * Caveats on high order pages: PG_buddy and PG_slab will only be set + * Caveats on high order pages: PG_buddy will only be set * on the head page. */ if (PageBuddy(page)) @@ -192,11 +201,6 @@ u64 stable_page_flags(struct page *page) u |= 1 << KPF_IDLE; u |= kpf_copy_bit(k, KPF_LOCKED, PG_locked); - - u |= kpf_copy_bit(k, KPF_SLAB, PG_slab); - if (PageTail(page) && PageSlab(page)) - u |= 1 << KPF_SLAB; - u |= kpf_copy_bit(k, KPF_ERROR, PG_error); u |= kpf_copy_bit(k, KPF_DIRTY, PG_dirty); u |= kpf_copy_bit(k, KPF_UPTODATE, PG_uptodate); @@ -214,10 +218,6 @@ u64 stable_page_flags(struct page *page) u |= kpf_copy_bit(k, KPF_UNEVICTABLE, PG_unevictable); u |= kpf_copy_bit(k, KPF_MLOCKED, PG_mlocked); -#ifdef CONFIG_MEMORY_FAILURE - u |= kpf_copy_bit(k, KPF_HWPOISON, PG_hwpoison); -#endif - #ifdef CONFIG_ARCH_USES_PG_UNCACHED u |= kpf_copy_bit(k, KPF_UNCACHED, PG_uncached); #endif From patchwork Tue Oct 10 14:28:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naoya Horiguchi X-Patchwork-Id: 13415666 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 C0882CD8C8B for ; Tue, 10 Oct 2023 14:30:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6578B8D00BC; Tue, 10 Oct 2023 10:30:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E07B8D0002; Tue, 10 Oct 2023 10:30:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CF718D00BC; Tue, 10 Oct 2023 10:30:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 390B88D0002 for ; Tue, 10 Oct 2023 10:30:55 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 10FFE802AF for ; Tue, 10 Oct 2023 14:30:54 +0000 (UTC) X-FDA: 81329788428.12.1D168E6 Received: from out-204.mta0.migadu.com (out-204.mta0.migadu.com [91.218.175.204]) by imf06.hostedemail.com (Postfix) with ESMTP id C6D751802ED for ; Tue, 10 Oct 2023 14:29:06 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=MWezG50+; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf06.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 91.218.175.204 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696948147; 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=R/QG0Z2F3QpUoVuiwm1cdKUqeM2tUh0VmscjJ0F6F+U=; b=EtYXsOS6XlzOzKzDgWvpoLDHBQlfOu+NsO+sZozDIZKKfY1h0rkBxLHkWbVlEfvBT6b1/3 0o37qXTuXQIQ82kC3aNAyQLbg4Rs9HXrQZCaCfJRJylxP9mEwNO9rlmwsgio51n4l35cn+ JuL7UllOhc7Bowazsl/0KobWck65wlg= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=MWezG50+; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf06.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 91.218.175.204 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696948147; a=rsa-sha256; cv=none; b=Kxx1eS+r7Oycn8YjPZ7KZNu6sNgfDCNjBzcqbOPjVJ5ZtsbEbSrplaln+i/5VJq5KcL3pD I8bVoDG7hqcy7yqnGwi2kNQoHt4Cda6q7ZAskfeztGiZ5xl0EePER588mIA40mwoll/OJx CFoHQ+rCCvGRxuVeJa4R2LzNUNUUVNo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1696948144; 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: in-reply-to:in-reply-to:references:references; bh=R/QG0Z2F3QpUoVuiwm1cdKUqeM2tUh0VmscjJ0F6F+U=; b=MWezG50+O7UF+lm6gT/NNY5RH7a9ZopHj6n/EIkn62Z4LPC8w5SNIXi0a8Rgj52GVjSvYo 3EvJzzjr7YfdBb0crTZGG+Hndwx69pJFC8xJobtbDgC16FB0JY6EgocjAcpWMzR122rcVV 9pbMUMojnK8Du56fogifM1zDVCrzEt8= From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , Matthew Wilcox , David Hildenbrand , "Kirill A. Shutemov" , Mike Kravetz , Miaohe Lin , Vlastimil Babka , Muchun Song , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: [PATCH v1 5/5] tools/mm/page-types.c: hide compound pages in non-raw mode Date: Tue, 10 Oct 2023 23:28:01 +0900 Message-Id: <20231010142801.3780917-6-naoya.horiguchi@linux.dev> In-Reply-To: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> References: <20231010142801.3780917-1-naoya.horiguchi@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: C6D751802ED X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: zku1rgraedtothh71fyxfkfihuyddho8 X-HE-Tag: 1696948146-907739 X-HE-Meta: U2FsdGVkX1+s9tshtMTBj8U+d9YobIP1N1oaX1+h0aEEfZPK8auuX+L0X4+AfjkzuWDKmaDrXKana228FnKlCqdFoiUZoKLfgqmEgTKmSx/Vo1ApNyVjK44RNZThmoE+vd4pMZGpBCWnvDFI3tlNB+FUCXLzOYZP23NhT3CSVKM9Rjn1+gTyVWI/cPyE9tj7bAeRdnFZsQWuQ0LK5qNx5jBvaJzLAx+UuuU+E8yrFbsVmu0PPpzg6ealPyu1pvTkflnuenXXhAW6s9Ax6vgn7oSieCAVI6Okfc0Cg5tu97oMHls13DFgrmUlK0DAevTcDR1jLEs3WE/RyCx3z5Ls3OY+E6xPOYouG3mmyjZyVCImlyxYrJnGbXhK22QM/oYmbQUDQvGb/E5vGmNLRdIiMUo11/x8ZqbWdp29AxrtNWwO4W9En4SZ1RFM8v3xbb87aLU3LOhgf3di4PKMdqV5bQG7vXK3fqhlSHUQ/y8hPmzTqf3Xi4Xp9b4+at+sZ/22uWQMNKcVoG3yQ5N2Aqycgr+v9yu3Qz3vz7Jexm5xCPbCCQqHgbZho78MdWIfyXruTH3O07sJoCMIEz9KYL8apdZKEeJ8TkMlOMRl8FCLHvG8kSYnOh5lWTHmCLBzYAEG8kYDrNI6Qmr3FITf2NimwG5/Mzy6u+ne27a4UGujyacMi2ufeOCdk3LFkfIg0xKr5LCya91kK6AQvXUfTYWAmtxXLztF6g721GBsnrbzndjIElTO/4j1vSUoTJhILksNUeogheZ/evyOFITaCBSt7x6k7Y+NOwEeT3j+zPLcXB+QqklEQYBRU8g5kTBzTtX38JZ+QJw/II0Le53g2sBqIWyvuQTMouuTGmXDnZOlsfPv3akTkao4x7hBl1Q0oSJLgOpKUA4gIYg8AFeW6mTKSAAF6tG5h8xdzqjwzEggcLCRkHYtHPj9QjapA2kRrG9ICgoaZC7wC698rLbyJXV jxSrE8jR WlCJqHKATgnyDJwxElIXhe/7PlYCDRqeObZM+tRF2SxDgq/sn4UbVsuzOF9ok008pY+eRQJqBM+sRPZTZ1taweipXJUH7gmqhHkL8 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: From: Naoya Horiguchi In non-raw mode (i.e. calling page-types without -r flag), any flags for compound pages except for hugetlb are supposed to be hidden. But currently KPF_THP is shown and the newly added flag KPF_FOLIO is also shown, which is unexpected. So hide them. Signed-off-by: Naoya Horiguchi --- tools/mm/page-types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c index b78448d19e88..c37e1e79bc61 100644 --- a/tools/mm/page-types.c +++ b/tools/mm/page-types.c @@ -508,7 +508,7 @@ static uint64_t well_known_flags(uint64_t flags) /* hide non-hugeTLB compound pages */ if ((flags & BITS_COMPOUND) && !(flags & BIT(HUGE))) - flags &= ~BITS_COMPOUND; + flags &= ~(BITS_COMPOUND|BIT(THP)|BIT(FOLIO)); return flags; }