From patchwork Mon Jan 30 04:25:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 13120405 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 A2E9DC54EED for ; Mon, 30 Jan 2023 04:25:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16F0D6B0072; Sun, 29 Jan 2023 23:25:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 11F538E0002; Sun, 29 Jan 2023 23:25:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F027E6B0074; Sun, 29 Jan 2023 23:25:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E230D6B0072 for ; Sun, 29 Jan 2023 23:25:44 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B6572A0AFD for ; Mon, 30 Jan 2023 04:25:44 +0000 (UTC) X-FDA: 80410177008.25.D8D2C74 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf29.hostedemail.com (Postfix) with ESMTP id D585C12000B for ; Mon, 30 Jan 2023 04:25:42 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=TrsrcayB; spf=pass (imf29.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=42.hyeyoo@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=1675052742; 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=Ddl5ubdJXdhY37QXaqSPFuWOXoIoME8XjzTIYCn2FfM=; b=JW0Od4milPX4Dfuj8uzxEFakVQd26S4YI1oQ4ryvEyIiWn9EeUuE7xlyM1ugxpkWsHQ2IS RTu5pBJUo051uHNoikSvqrwnuXZQdsl5j6MBp4CT9NVbJtZrviBex6UP3SlirrT67ai3FU YwDaGvFUCqkdh1ysJdGOLgPNzPpASHA= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=TrsrcayB; spf=pass (imf29.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675052742; a=rsa-sha256; cv=none; b=3m7aghsnFYhBbHgosEqDhS95K/bKqXrH4bA9EbJ2G+U785vVl2iKaTplb9zxrhBM8A2FZj zRtl6TNl2SjGK+D57Gd3k2mttmBfQuQPdWN6ULUBZE6hiFGgvJVuG3JfMgKfRZa0Qy6lRO zgU6wtB8hkVNRYe8zPIXKzibdoDvTZI= Received: by mail-pf1-f176.google.com with SMTP id n2so6842272pfo.3 for ; Sun, 29 Jan 2023 20:25:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=Ddl5ubdJXdhY37QXaqSPFuWOXoIoME8XjzTIYCn2FfM=; b=TrsrcayBW/ufr6B0b7ySUMgYrDdrlI1lmymJVug4Ai+xm9Efhi9PJpmJAq0XdcYAEi nQT+yasgYhwPxylv5Ay2NG7qWqlQEidG/nPOxhClNZYhEh1uCdBq6Cz66BopIlWiSax7 ZyAW40TGTUCdLLapAVdvy0LIAAidA2fB8uXqJ2+s1diIMYaNAA50slhM1O5gSS1CO2/D BM0Q6Af/Vk/ESFCz1P/NZBOr74dhaWS7ufOGHTwk9VFYGKrE8iV/LHBDBXLClRsiB4ai VYKlqSwQ8MYwtAExxiSyESGSy1lnp8BlLj+/HPJSFN+MhPhMRElH7chEMLvlGGW9hRtm eRKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Ddl5ubdJXdhY37QXaqSPFuWOXoIoME8XjzTIYCn2FfM=; b=bs4VDNLmE07ZkCkmFthFlMO0FcyBzWoPdmMyCiAzIGDvCD0Uvudj3IjfDZSFwKBuah F5vzmDsV+g9ajGFblzLJMbOqnGP+IeqfcxWtMKtRT4SwHATpqtOS0hXW5PFljDMJt8dy OfLmIheHjelmL38HQdXPhuROORgl/6vIVN3Pt7RbUJl031BMQXMLrUfpCLFrYmNqw0LH HMLjhKltr/dNWLMFlcQ5MS0w0UD3KhQQxN1Z1AxnyoSlqFoEdFqcyjdI2PULg69+/cWV 78WSWAPXmjWaZXbq6NTXjVh8Gu+Md787zd4ieWnnMWlEDCWKcFJrltZO99dsZqGpGFKE ek9Q== X-Gm-Message-State: AO0yUKXCJso9xVluwNp1dhg3JZuONG7q78WtQ+POMPw7Vg/KpkiGvPvk YDP3hS7GlBCyNAR8/aE1xPU= X-Google-Smtp-Source: AK7set/g64z3OvggFkD0Z2RB8lO0nvGTzCuFS0OJ7oPDugPEV5kn1VJtceRXiEDz6GS84tqVRQdhbg== X-Received: by 2002:a62:1742:0:b0:590:772c:b990 with SMTP id 63-20020a621742000000b00590772cb990mr16502661pfx.15.1675052741760; Sun, 29 Jan 2023 20:25:41 -0800 (PST) Received: from localhost.localdomain ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id 138-20020a621790000000b0059312530b54sm4275969pfx.180.2023.01.29.20.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Jan 2023 20:25:40 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Andrew Morton Cc: Joe Perches , Petr Mladek , Andy Shevchenko , Steven Rostedt , Vlastimil Babka , Matthew WilCox , David Hildenbrand , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH mm-unstable v4 1/3] mmflags.h: use less error prone method to define pageflag_names Date: Mon, 30 Jan 2023 13:25:12 +0900 Message-Id: <20230130042514.2418-2-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230130042514.2418-1-42.hyeyoo@gmail.com> References: <20230130042514.2418-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Stat-Signature: gsjfhjypfu6g1wtfi1a9ad6jc4bx3n93 X-Rspamd-Queue-Id: D585C12000B X-HE-Tag: 1675052742-367931 X-HE-Meta: U2FsdGVkX18kIC+WVn3yNzJCPJ2j5Ll2LTjhezIVdzxLckwxcJUkaXNPlBG/Nw34htFDyY0uvdFyt4XkJN+CeqfWc7XwczA7cSHiz5QqcZq7JztX97gOiJ4fEcWepKEz+lpqyRffpZCRsDT2eeR3uD29PlWITDHfIfipIj93JboVry+qZ73Njp6TV0xYFd8V3BTQ/TWcX4RkPpGO8jmzDy6n4iLYeBeQWehQsXrckayjKM4svdQuo98kOaIjbdsOTcsms/U1l6gRQ9OfRxzwVNvhQ6L6opUVPcYGLXtUi9cvP/papb9AWiE9tIxp2aMFVPbazwjE04e4NZ9+MR7Ngvq1p32hBPObrlEe+S2NxmrxKEyortdh75x1bOihpik3X9SUqB1EkBp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QLKDStLd0iUEnIj/4YiJqoQe+7/05vs4sHA5qU9dTrk1TtieWlVTYNgGZON5IcD9jQxhrSBQjAk7A3PIiiMI6cON4GR9x240h9/YasX1+lDTPXQarQIN23QgxxqgwPoOLObOIJp8bxGn+eFko6wAYbrwdCZNlm980IAP8FJxiRoySuE/EC2ZidrW4ifO/sCZqcbZnWZm9pApQhm5QZRnVai5/XKVURgpSTTPN3kuN 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: As suggested by Andy Shevchenko, use helper macro to decrease chances of typo when defining pageflag_names. Link: https://lore.kernel.org/lkml/Y6AycLbpjVzXM5I9@smile.fi.intel.com Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Andy Shevchenko --- include/trace/events/mmflags.h | 85 ++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 9db52bc4ce19..f453babe29b3 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -67,71 +67,74 @@ ) : "none" #ifdef CONFIG_MMU -#define IF_HAVE_PG_MLOCK(flag,string) ,{1UL << flag, string} +#define IF_HAVE_PG_MLOCK(_name) ,{1UL << PG_##_name, __stringify(_name)} #else -#define IF_HAVE_PG_MLOCK(flag,string) +#define IF_HAVE_PG_MLOCK(_name) #endif #ifdef CONFIG_ARCH_USES_PG_UNCACHED -#define IF_HAVE_PG_UNCACHED(flag,string) ,{1UL << flag, string} +#define IF_HAVE_PG_UNCACHED(_name) ,{1UL << PG_##_name, __stringify(_name)} #else -#define IF_HAVE_PG_UNCACHED(flag,string) +#define IF_HAVE_PG_UNCACHED(_name) #endif #ifdef CONFIG_MEMORY_FAILURE -#define IF_HAVE_PG_HWPOISON(flag,string) ,{1UL << flag, string} +#define IF_HAVE_PG_HWPOISON(_name) ,{1UL << PG_##_name, __stringify(_name)} #else -#define IF_HAVE_PG_HWPOISON(flag,string) +#define IF_HAVE_PG_HWPOISON(_name) #endif #if defined(CONFIG_PAGE_IDLE_FLAG) && defined(CONFIG_64BIT) -#define IF_HAVE_PG_IDLE(flag,string) ,{1UL << flag, string} +#define IF_HAVE_PG_IDLE(_name) ,{1UL << PG_##_name, __stringify(_name)} #else -#define IF_HAVE_PG_IDLE(flag,string) +#define IF_HAVE_PG_IDLE(_name) #endif #ifdef CONFIG_ARCH_USES_PG_ARCH_X -#define IF_HAVE_PG_ARCH_X(flag,string) ,{1UL << flag, string} +#define IF_HAVE_PG_ARCH_X(_name) ,{1UL << PG_##_name, __stringify(_name)} #else -#define IF_HAVE_PG_ARCH_X(flag,string) +#define IF_HAVE_PG_ARCH_X(_name) #endif #ifdef CONFIG_KASAN_HW_TAGS -#define IF_HAVE_PG_SKIP_KASAN_POISON(flag,string) ,{1UL << flag, string} +#define IF_HAVE_PG_SKIP_KASAN_POISON(_name) \ + ,{1UL << PG_##_name, __stringify(_name)} #else -#define IF_HAVE_PG_SKIP_KASAN_POISON(flag,string) +#define IF_HAVE_PG_SKIP_KASAN_POISON(_name) #endif +#define DEF_PAGEFLAG_NAME(_name) { 1UL << PG_##_name, __stringify(_name) } + #define __def_pageflag_names \ - {1UL << PG_locked, "locked" }, \ - {1UL << PG_waiters, "waiters" }, \ - {1UL << PG_error, "error" }, \ - {1UL << PG_referenced, "referenced" }, \ - {1UL << PG_uptodate, "uptodate" }, \ - {1UL << PG_dirty, "dirty" }, \ - {1UL << PG_lru, "lru" }, \ - {1UL << PG_active, "active" }, \ - {1UL << PG_workingset, "workingset" }, \ - {1UL << PG_slab, "slab" }, \ - {1UL << PG_owner_priv_1, "owner_priv_1" }, \ - {1UL << PG_arch_1, "arch_1" }, \ - {1UL << PG_reserved, "reserved" }, \ - {1UL << PG_private, "private" }, \ - {1UL << PG_private_2, "private_2" }, \ - {1UL << PG_writeback, "writeback" }, \ - {1UL << PG_head, "head" }, \ - {1UL << PG_mappedtodisk, "mappedtodisk" }, \ - {1UL << PG_reclaim, "reclaim" }, \ - {1UL << PG_swapbacked, "swapbacked" }, \ - {1UL << PG_unevictable, "unevictable" } \ -IF_HAVE_PG_MLOCK(PG_mlocked, "mlocked" ) \ -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_X(PG_arch_2, "arch_2" ) \ -IF_HAVE_PG_ARCH_X(PG_arch_3, "arch_3" ) \ -IF_HAVE_PG_SKIP_KASAN_POISON(PG_skip_kasan_poison, "skip_kasan_poison") + DEF_PAGEFLAG_NAME(locked), \ + DEF_PAGEFLAG_NAME(waiters), \ + DEF_PAGEFLAG_NAME(error), \ + DEF_PAGEFLAG_NAME(referenced), \ + DEF_PAGEFLAG_NAME(uptodate), \ + DEF_PAGEFLAG_NAME(dirty), \ + DEF_PAGEFLAG_NAME(lru), \ + DEF_PAGEFLAG_NAME(active), \ + DEF_PAGEFLAG_NAME(workingset), \ + DEF_PAGEFLAG_NAME(slab), \ + DEF_PAGEFLAG_NAME(owner_priv_1), \ + DEF_PAGEFLAG_NAME(arch_1), \ + DEF_PAGEFLAG_NAME(reserved), \ + DEF_PAGEFLAG_NAME(private), \ + DEF_PAGEFLAG_NAME(private_2), \ + DEF_PAGEFLAG_NAME(writeback), \ + DEF_PAGEFLAG_NAME(head), \ + DEF_PAGEFLAG_NAME(mappedtodisk), \ + DEF_PAGEFLAG_NAME(reclaim), \ + DEF_PAGEFLAG_NAME(swapbacked), \ + DEF_PAGEFLAG_NAME(unevictable) \ +IF_HAVE_PG_MLOCK(mlocked) \ +IF_HAVE_PG_UNCACHED(uncached) \ +IF_HAVE_PG_HWPOISON(hwpoison) \ +IF_HAVE_PG_IDLE(idle) \ +IF_HAVE_PG_IDLE(young) \ +IF_HAVE_PG_ARCH_X(arch_2) \ +IF_HAVE_PG_ARCH_X(arch_3) \ +IF_HAVE_PG_SKIP_KASAN_POISON(skip_kasan_poison) #define show_page_flags(flags) \ (flags) ? __print_flags(flags, "|", \