On Thu, 16 Jan 2025 11:00:20 -0800 Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > On Thu, 16 Jan 2025 at 10:23, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > > > > --- a/include/linux/gfp_types.h > > +++ b/include/linux/gfp_types.h > > No - please do these somewhere else. > > This header is included by *everything*. > > Put it in some tracing header that isn't. > But they are only defines, they are not created until used. Are you worried that it will slow down the compile? I wanted this to stay close to where they are crated so they can keep in sync, and not break when something new is added. Another way is to have something like: diff --git a/include/linux/gfp_types.h b/include/linux/gfp_types.h index 4591a3e1711d..65c61c7b9f22 100644 --- a/include/linux/gfp_types.h +++ b/include/linux/gfp_types.h @@ -23,41 +23,66 @@ typedef unsigned int __bitwise gfp_t; * include/trace/events/mmflags.h and tools/perf/builtin-kmem.c */ -enum { - ___GFP_DMA_BIT, - ___GFP_HIGHMEM_BIT, - ___GFP_DMA32_BIT, - ___GFP_MOVABLE_BIT, - ___GFP_RECLAIMABLE_BIT, - ___GFP_HIGH_BIT, - ___GFP_IO_BIT, - ___GFP_FS_BIT, - ___GFP_ZERO_BIT, - ___GFP_UNUSED_BIT, /* 0x200u unused */ - ___GFP_DIRECT_RECLAIM_BIT, - ___GFP_KSWAPD_RECLAIM_BIT, - ___GFP_WRITE_BIT, - ___GFP_NOWARN_BIT, - ___GFP_RETRY_MAYFAIL_BIT, - ___GFP_NOFAIL_BIT, - ___GFP_NORETRY_BIT, - ___GFP_MEMALLOC_BIT, - ___GFP_COMP_BIT, - ___GFP_NOMEMALLOC_BIT, - ___GFP_HARDWALL_BIT, - ___GFP_THISNODE_BIT, - ___GFP_ACCOUNT_BIT, - ___GFP_ZEROTAGS_BIT, +#define GFP_BITS_GENERAL \ + EM(DMA) \ + EM(HIGHMEM) \ + EM(DMA32) \ + EM(MOVABLE) \ + EM(RECLAIMABLE) \ + EM(HIGH) \ + EM(IO) \ + EM(FS) \ + EM(ZERO) \ + EM(UNUSED_BIT) \ + EM(DIRECT_RECLAIM) \ + EM(KSWAPD_RECLAIM) \ + EM(WRITE) \ + EM(NOWARN) \ + EM(RETRY_MAYFAIL) \ + EM(NOFAIL) \ + EM(NORETRY) \ + EM(MEMALLOC) \ + EM(COMP) \ + EM(NOMEMALLOC) \ + EM(HARDWALL) \ + EM(THISNODE) \ + EM(ACCOUNT) \ + EM(ZEROTAGS) + #ifdef CONFIG_KASAN_HW_TAGS - ___GFP_SKIP_ZERO_BIT, - ___GFP_SKIP_KASAN_BIT, +# define GFP_BITS_KASAN \ + EM(SKIP_ZERO) \ + EM(SKIP_KASAN) +#else +# define GFP_BITS_KASAN #endif + #ifdef CONFIG_LOCKDEP - ___GFP_NOLOCKDEP_BIT, +# define GFP_BITS_LOCKDEP \ + EM(NOLOCKDEP) +#else +# define GFP_BITS_LOCKDEP #endif + #ifdef CONFIG_SLAB_OBJ_EXT - ___GFP_NO_OBJ_EXT_BIT, +# define GFP_BITS_SLAB \ + EM(NO_OBJ_EXT) +#else +# define GFP_BITS_SLAB #endif + +# define GFP_BITS \ + GFP_BITS_GENERAL \ + GFP_BITS_KASAN \ + GFP_BITS_LOCKDEP \ + GFP_BITS_SLAB + + +#undef EM +#define EM(a) ___GFP_##a##_BIT, + +enum { + GFP_BITS ___GFP_LAST_BIT }; Then I could just use the GFP_BITS and redefine the EM() to add the TRACE_DEFINE_ENUM() around them. Or something similar. But I didn't think you would go for that. -- Steve