From patchwork Thu Jan 16 21:41:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13942348 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 75064C02188 for ; Thu, 16 Jan 2025 21:44:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA9936B0089; Thu, 16 Jan 2025 16:44:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B3EC66B008C; Thu, 16 Jan 2025 16:44:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 93EE06B0092; Thu, 16 Jan 2025 16:44:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5E4176B008C for ; Thu, 16 Jan 2025 16:44:35 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 144C88134D for ; Thu, 16 Jan 2025 21:44:35 +0000 (UTC) X-FDA: 83014644510.05.DBD586B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 7C3C540003 for ; Thu, 16 Jan 2025 21:44:33 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of "SRS0=fJp8=UI=goodmis.org=rostedt@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=fJp8=UI=goodmis.org=rostedt@kernel.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737063873; 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-type:content-transfer-encoding:in-reply-to: references:references; bh=/rIqZmDPrVgk76MgnnVg9ZnzqSmYKmPBYK4wKogGOsc=; b=BdTxX+gVYz/7JZ4DGIsrcsxyiUPpMouGdNHOiS7FG8zkejKS8yL14TEGEPORKCZmAz8EPz b3mJt52U6Jc0NByWMZrD53iKQVjcDLYKz1tnyVWWm6a/D0LOOtm1hhcglxLI/neDJkcSNO 9rbGxwWVrSvGoxaJOzOjARlXIeuoZ0o= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737063873; a=rsa-sha256; cv=none; b=v2l/gr6KttwhwD3nsUPpvHtA2W5mQ7VBfpgbC9N+irH/YJLH01A11SSoGBzKZGmDp/Il39 rUVSIt+xcMZ0rr8DDhIbgpGqCxh4npA947dV+8hbt1z5ZpYEx8Nnzdtpkpwksb/ytGRXKk rNinLqQiSHsnLqCrV4HSp1Sqr9nbUEo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of "SRS0=fJp8=UI=goodmis.org=rostedt@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=fJp8=UI=goodmis.org=rostedt@kernel.org"; dmarc=none Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0F0C25C0C49; Thu, 16 Jan 2025 21:43:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78C79C4CEE3; Thu, 16 Jan 2025 21:44:32 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tYXfL-00000000yyx-17tJ; Thu, 16 Jan 2025 16:44:39 -0500 Message-ID: <20250116214439.046082618@goodmis.org> User-Agent: quilt/0.68 Date: Thu, 16 Jan 2025 16:41:25 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, linux-perf-users@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Michael Petlan , Veronika Molnarova , Suren Baghdasaryan , Linus Torvalds Subject: [PATCH v2 2/2] tracing: gfp: Remove duplication of recording GFP flags References: <20250116214123.917928229@goodmis.org> MIME-Version: 1.0 X-Stat-Signature: 4d5q8r3husjyzan3jcejbm5qjuhjtns5 X-Rspamd-Queue-Id: 7C3C540003 X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1737063873-371217 X-HE-Meta: U2FsdGVkX18VbVTQSGeqfJvVyLiiQt1yWr1dIjMDxpv/GB5EbTCRIazunRFZ6XCbw3WFvwf4rKBqhqvQ5mjljFgeItwmxg38M96uS/ZYxCl8IniO9BMxRKtp91wrX8e+eN2nSHROGL6Ac1lyi5Gp6ogi1gzC3IVsMo/B0JIDAgPesNQFBiIYE+z0TvkdY6/wx2LpStCfzMr9HBlWyss8HTUyJulY8AKVAKAGlzawhwftNJ+4nWAmz7+n2amdIW4jIrI4O8CaqfKHv9L7hPrn9bzPaWolHJUjThl/YV2RbQFNPmwA4DNJYDal4yD48j97qz0nSj8XzAsGCiO9tjnEyRneyvR9kEaKzLgMk8Jdu8RQqbCouZoMMwQ8VdpnDnhSHU+xAfU3ZDw413fhj8O5sgt+WkTdJngFJmdw4GuDXidkjoQNyr0ZfcHOw++SRsL8Yo7S7RlK2q0oUfR9zCcXshDajv+B5Kn4fpwRzkL86DKPdadVZ+Md0Z0MgfyYHP5IWpYcyZ/frOqblpuLOMv/aek2F2TiBzdL4MdiEZV5QcOy/GXEbVkF1XQuWJNUTWvmm8HRqMKAgcpG7l9ryX9d4hyypbf3MH8zrrWmZgRr1q+VRtWN0V/S1rvuUEMBMqWsSm6vAv784GBvTl90GOA8miYMLLoUBwkcppdM4Z/7KrAwWJ+28jE0eiIoFYHyOQ3weId2iyjhz7ZlJdR93DrR56NkxJ9kWqHrzv63XdoYU2L2TCMzmBuHg2067swUtuGORUSRoOI7XYh0J6vT52A8RxCditW/YUFe56BWBnw6Ifw6QK0h5weTFw1iCzoms8YjN1ADpbZUlkTf06wT3h/77zcGPxM93xxSJ9JubadcHH2HP7JDZacC7lrSTuAQhlVyV9VRiphij2qwVpYHvFaJHhGHOoWfpFHAs7x6eiKoKiajl3R8QsQGIDybEf4rszvYNNjOWo2gNS3QR7f33Dq nd3NJJYX s2RMbOmEZ2IsHPuXg1P50GNsIIcKlR4Bpn6UL7rN7EvyTs/7g0jNAZtGZ4J0kunHoSPP4meMF7BdWjQQXpKMVzYBkk9iVexsPkkOBe+MMgusqibXpj2S2q3VwXVzvcWJojQdpUSUsBdD6lBC9ZCoIXqm7ZeJv99k0WNFEBPCcdtFoPNfaTH24Wrq/7iujDwAURETaCK09ammUPZVGBEVina+4wsSVZwgfZR2FEawH9dwrFxeXikTXPi8/+/lzmcVFRUse6ua4WfiKjQ5iGcx7joNfRA9c+jm6v8yjARnfx6FP0JcmCSCOcxVN52MEUx0qk/tac7gD8P6ay2duaEOS5+v82yJXU2IPE07+ 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: Steven Rostedt The gfp_flags when recorded in the trace require being converted from their numbers to values. Various macros are used to help facilitate this, but there's two sets of macros that need to keep track of the same GFP flags to stay in sync. The TRACE_GFP_FLAGS macro holds the enum ___GFP_*_BIT defined bits, and creates the TRACE_DEFINE_ENUM() wrapper around them. The __def_gfpflag_names() macro creates the mapping of various flags or multiple flags to give them human readable names via the __print_flags() tracing helper macro. As the TRACE_GFP_FLAGS is a subset of the __def_gfpflags_names(), it can be used to cover the individual bit names, by redefining the internal macro TRACE_GFP_EM(): #undef TRACE_GFP_EM #define TRACE_GFP_EM(a) gfpflag_string(__GFP_##a), This will remove the bits that are duplicate between the two macros. If a new bit is created, only the TRACE_GFP_FLAGS needs to be updated and that will also update the __def_gfpflags_names() macro. Signed-off-by: Steven Rostedt (Google) --- include/trace/events/mmflags.h | 41 +++++++++------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index d36c857dd249..8cabdce23a62 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -78,6 +78,13 @@ TRACE_DEFINE_ENUM(___GFP_LAST_BIT); #define gfpflag_string(flag) {(__force unsigned long)flag, #flag} +/* + * For the values that match the bits, use the TRACE_GFP_FLAGS + * which will allow any updates to be included automatically. + */ +#undef TRACE_GFP_EM +#define TRACE_GFP_EM(a) gfpflag_string(__GFP_##a), + #define __def_gfpflag_names \ gfpflag_string(GFP_TRANSHUGE), \ gfpflag_string(GFP_TRANSHUGE_LIGHT), \ @@ -91,41 +98,13 @@ TRACE_DEFINE_ENUM(___GFP_LAST_BIT); gfpflag_string(GFP_NOIO), \ gfpflag_string(GFP_NOWAIT), \ gfpflag_string(GFP_DMA), \ - gfpflag_string(__GFP_HIGHMEM), \ gfpflag_string(GFP_DMA32), \ - gfpflag_string(__GFP_HIGH), \ - gfpflag_string(__GFP_IO), \ - gfpflag_string(__GFP_FS), \ - gfpflag_string(__GFP_NOWARN), \ - gfpflag_string(__GFP_RETRY_MAYFAIL), \ - gfpflag_string(__GFP_NOFAIL), \ - gfpflag_string(__GFP_NORETRY), \ - gfpflag_string(__GFP_COMP), \ - gfpflag_string(__GFP_ZERO), \ - gfpflag_string(__GFP_NOMEMALLOC), \ - gfpflag_string(__GFP_MEMALLOC), \ - gfpflag_string(__GFP_HARDWALL), \ - gfpflag_string(__GFP_THISNODE), \ - gfpflag_string(__GFP_RECLAIMABLE), \ - gfpflag_string(__GFP_MOVABLE), \ - gfpflag_string(__GFP_ACCOUNT), \ - gfpflag_string(__GFP_WRITE), \ gfpflag_string(__GFP_RECLAIM), \ - gfpflag_string(__GFP_DIRECT_RECLAIM), \ - gfpflag_string(__GFP_KSWAPD_RECLAIM), \ - gfpflag_string(__GFP_ZEROTAGS) - -#ifdef CONFIG_KASAN_HW_TAGS -#define __def_gfpflag_names_kasan , \ - gfpflag_string(__GFP_SKIP_ZERO), \ - gfpflag_string(__GFP_SKIP_KASAN) -#else -#define __def_gfpflag_names_kasan -#endif + TRACE_GFP_FLAGS \ + { 0, "none" } #define show_gfp_flags(flags) \ - (flags) ? __print_flags(flags, "|", \ - __def_gfpflag_names __def_gfpflag_names_kasan \ + (flags) ? __print_flags(flags, "|", __def_gfpflag_names \ ) : "none" #ifdef CONFIG_MMU