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); /*