From patchwork Wed Aug 10 19:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 12940951 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0E73C00140 for ; Wed, 10 Aug 2022 19:32:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=t0BDGFTpCqZACFFStaBMOElfZsYqz+EiYI5A13JpG3s=; b=IGyWvDR1I2BS+nydOcXeB10wiV 2xT7oQ2ZxMHHrZj+f6J2clKo8cTfYbwjScUqIdxRMLEjl+RDVYcWjZ3KUBh/Gic/iklIRnrvBQrDg uILBIwr7D9Bod7znfsMOSpWMlbBXlNP4FKRWg4AVXA205LwIGA9laNttsswVOrLu7BIWiOTJF59tL DDtKGzQhfD6gfmdCYUqJrgR2Cur4qbhytkYUYq0MEwP7ME8d2IQEfNhgIbl1ucMiQhg3p3OKGXCre b+iTp1hzaJGcChQz2O3heIU5zqvIZAv9TO7HWgmGkY4i7R/q52kH+1URxcxpOIcY1ZtYi76IxdSHQ 9c0hZmgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLrQD-00EC0c-OG; Wed, 10 Aug 2022 19:31:17 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLrPi-00EBgK-7k for linux-arm-kernel@lists.infradead.org; Wed, 10 Aug 2022 19:30:48 +0000 Received: by mail-yb1-xb49.google.com with SMTP id x19-20020a25e013000000b0067c0cedc96bso6120199ybg.21 for ; Wed, 10 Aug 2022 12:30:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc; bh=Kifgnty8wg8EK2E1LOfDfA0Z3FKljaVXfcfUN76Fd74=; b=AEHXNbwIZkZmVSCglicIZVkv9ps8jS4TWInv+dVN6TvLyORjLLwspMXTxneW8qNDkP pAvdD4cPTox2bYSpmt3hvFRKQWu3Oe6oqizbPO1YzT3OTytXBJznpfosafaQfsxFWzCP R3VelrImNZlAzUBz6UYiVXt5vclJnonNTMm+u7KzDpUNo+mItmtuI7f3+WiR9V8D1YIW oWank4bbjF/xuhdGeroyngL5kZXu8anYXjXXIwA4o29qD0xbr/Xn3FmWsor98lllNBgp NPUyaSKF6Y+U0lldeeYKnX7kHBt72E7mKKaKgsVVZV4129FiPlUPaDN5p0JT75uhKmwX J7YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc; bh=Kifgnty8wg8EK2E1LOfDfA0Z3FKljaVXfcfUN76Fd74=; b=dy+58GvK+HW7fQjCkIJtZUcceVZjDooBHkTQSI5hTWVvXngjHwHWYwHBKY55tBuwtn sF56GMxli3yGOIz96216fTQpH3o6MI0ws/+r4o6Rmv4DSrQfmU5kjhcbWLv2ArWh1YBW wl53x7/76UmKwLfXIpKzKYT0iSBTqcdDP03RD2TCuPcO0x+dy1iOJBo1NHJp5WRHBC4q NJV6dFfZ7aphrCmXnsK3UxJ9tQbj+hAjDAOXWWRrFF039NNMO55Em6k5aBZeL8DS0IBh kcEfq58HG4eTWrHPZ6XTagDn0QNIxX6rVyYmkQ4QbDZsrkh8WH9Ogv4e/gUqVnKP3PcL 9F6g== X-Gm-Message-State: ACgBeo3LzqHWtFxHL8fG2mcdfZr7HeauFbrV/2yF4RlIl0eSXn+b4k3L UA9YH1yadmhqv3kcrl/wN2+d7C0bTJvNAzPLEcD1jAYuV6zMAUxqmZbyRStD8tQmW6OJUZ6pDpr D3ikpGwZ1SAjiwqlVoEoMcxaalfLtDSELbLcW/QApWAzuprsZT0hcwDzonmpZgBN6E8FsXOKx X-Google-Smtp-Source: AA6agR5Kth9/FBYXU8AQovDLBQ+DreNq4HSnqEXzSbwbLJ9mXTKOmVoF4L3eTu2vV2OQ4bzGuxXgOBA= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:200:4d8b:fb2a:2ecb:c2bb]) (user=pcc job=sendgmr) by 2002:a0d:ed83:0:b0:31d:3928:31b6 with SMTP id w125-20020a0ded83000000b0031d392831b6mr30111017ywe.98.1660159844817; Wed, 10 Aug 2022 12:30:44 -0700 (PDT) Date: Wed, 10 Aug 2022 12:30:29 -0700 In-Reply-To: <20220810193033.1090251-1-pcc@google.com> Message-Id: <20220810193033.1090251-4-pcc@google.com> Mime-Version: 1.0 References: <20220810193033.1090251-1-pcc@google.com> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog Subject: [PATCH v3 3/7] mm: Add PG_arch_3 page flag From: Peter Collingbourne To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: Peter Collingbourne , Cornelia Huck , Catalin Marinas , Will Deacon , Marc Zyngier , Evgenii Stepanov , kvm@vger.kernel.org, Steven Price , Vincenzo Frascino X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_123046_317885_D5C78B3A X-CRM114-Status: GOOD ( 13.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As with PG_arch_2, this flag is only allowed on 64-bit architectures due to the shortage of bits available. It will be used by the arm64 MTE code in subsequent patches. Signed-off-by: Peter Collingbourne Cc: Will Deacon Cc: Marc Zyngier Cc: Steven Price [catalin.marinas@arm.com: added flag preserving in __split_huge_page_tail()] Signed-off-by: Catalin Marinas Reported-by: kernel test robot --- v3: - fix page flag dumping fs/proc/page.c | 1 + include/linux/kernel-page-flags.h | 1 + include/linux/page-flags.h | 1 + include/trace/events/mmflags.h | 7 ++++--- mm/huge_memory.c | 1 + tools/vm/page-types.c | 2 ++ 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/proc/page.c b/fs/proc/page.c index a2873a617ae8..0129aa3cfb7a 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -220,6 +220,7 @@ u64 stable_page_flags(struct page *page) u |= kpf_copy_bit(k, KPF_ARCH, PG_arch_1); #ifdef CONFIG_64BIT u |= kpf_copy_bit(k, KPF_ARCH_2, PG_arch_2); + u |= kpf_copy_bit(k, KPF_ARCH_3, PG_arch_3); #endif return u; diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h index eee1877a354e..859f4b0c1b2b 100644 --- a/include/linux/kernel-page-flags.h +++ b/include/linux/kernel-page-flags.h @@ -18,5 +18,6 @@ #define KPF_UNCACHED 39 #define KPF_SOFTDIRTY 40 #define KPF_ARCH_2 41 +#define KPF_ARCH_3 42 #endif /* LINUX_KERNEL_PAGE_FLAGS_H */ diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 465ff35a8c00..ad01a3abf6c8 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -134,6 +134,7 @@ enum pageflags { #endif #ifdef CONFIG_64BIT PG_arch_2, + PG_arch_3, #endif #ifdef CONFIG_KASAN_HW_TAGS PG_skip_kasan_poison, diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 11524cda4a95..704380179986 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -91,9 +91,9 @@ #endif #ifdef CONFIG_64BIT -#define IF_HAVE_PG_ARCH_2(flag,string) ,{1UL << flag, string} +#define IF_HAVE_PG_ARCH_2_3(flag,string) ,{1UL << flag, string} #else -#define IF_HAVE_PG_ARCH_2(flag,string) +#define IF_HAVE_PG_ARCH_2_3(flag,string) #endif #ifdef CONFIG_KASAN_HW_TAGS @@ -129,7 +129,8 @@ IF_HAVE_PG_UNCACHED(PG_uncached, "uncached" ) \ IF_HAVE_PG_HWPOISON(PG_hwpoison, "hwpoison" ) \ IF_HAVE_PG_IDLE(PG_young, "young" ) \ IF_HAVE_PG_IDLE(PG_idle, "idle" ) \ -IF_HAVE_PG_ARCH_2(PG_arch_2, "arch_2" ) \ +IF_HAVE_PG_ARCH_2_3(PG_arch_2, "arch_2" ) \ +IF_HAVE_PG_ARCH_2_3(PG_arch_3, "arch_3" ) \ IF_HAVE_PG_SKIP_KASAN_POISON(PG_skip_kasan_poison, "skip_kasan_poison") #define show_page_flags(flags) \ diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 0611b2fd145a..262e9ca627fb 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2399,6 +2399,7 @@ static void __split_huge_page_tail(struct page *head, int tail, (1L << PG_unevictable) | #ifdef CONFIG_64BIT (1L << PG_arch_2) | + (1L << PG_arch_3) | #endif (1L << PG_dirty))); diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c index 381dcc00cb62..364373f5bba0 100644 --- a/tools/vm/page-types.c +++ b/tools/vm/page-types.c @@ -79,6 +79,7 @@ #define KPF_UNCACHED 39 #define KPF_SOFTDIRTY 40 #define KPF_ARCH_2 41 +#define KPF_ARCH_3 42 /* [47-] take some arbitrary free slots for expanding overloaded flags * not part of kernel API @@ -138,6 +139,7 @@ static const char * const page_flag_names[] = { [KPF_UNCACHED] = "c:uncached", [KPF_SOFTDIRTY] = "f:softdirty", [KPF_ARCH_2] = "H:arch_2", + [KPF_ARCH_3] = "H:arch_3", [KPF_ANON_EXCLUSIVE] = "d:anon_exclusive", [KPF_READAHEAD] = "I:readahead",