From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.218 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793676254; b=IDcURzlA+w2c/c/vYYfqwS0TjEYNFw5lFT2e++l7UN7LQs55m0fsawiKv27+iKEbx1n0 s8pqaOl6otUv90T4DKEXoi2kM5ZoXwVg4SnIOK0UanZ3pPeQjo95emBahyw/SwMkym3VA FJ9Sm0r1/PO5s8xiTKS7LVyYrejVCB3TrUtuu3oG3yTkIrsGaSKoIFBtamdfSbCSZT0jh /XmZTHaFyaJHMzDqy1vVxcTpcjguCyGhcpExn8ZppNO5BApmnSwISZrMyONHqolZ5MAL/ HY0oOLHilFBfUW6KTL5nsZ0InuU91cm8TyisCNoCVruWOQ1u9LAray6rE7NBDnlI7DQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793676254; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=wp5wIsqhtLnbvTQSbQDkpP6Lf3VZf9FET+wJGcOPy6c=; b=nTnN8/3U7hGxdCAukjVRgyJ0opajy6+B2ao8uyQevmF/ic0xLcthwMR5MTwXsp7z0Z59 Fc4ezNoEzLHLGi+sPWXbmgCDwuUnh0Zw4kqyFdPrPV9aFbiIH7rNozEU8rUGo0bHN+J/p 0s+oFy6gGimTiXFhdvxQcSFLTr8xMxf/lShbgQGQnPGS6QhFFOo0SW8NnF0qWMKWbpA8u C63LVKAKtKFUckCe2uhUVssO5SH25r2lk+nA5fErMmvP0Xld5gNsiA0gWDGZErMqYvCT4 UdvAH2OSa8Lwqg1d04mOsmOugYUQ2i32LwWeDjlNlPuAdG9mMQjPwIfzrrewa4Yy+GQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=pg7DV0Uf; arc=none smtp.remote-ip=91.218.175.218 Received: from mta0.migadu.com (out-218.mta0.migadu.com [91.218.175.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EED1606A327 for ; Tue, 3 Nov 2026 03:24:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3EED1606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=pg7DV0Uf X-Envelope-To: bpf@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=WfKCC0CPaetlNjBgBzLRFTMpxvJUSOO4JuL3J0g1AR0=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1793676251; v=1; x=1794281051; b=pg7DV0UfbU/4/aLLusRljQNxRNlkAqmaOmpsqc4y1d2UF3zLuDciHx5aDHN4Lc+F5klOhuVX XAwf/+2h8Iq9tlKh8V7EbQJzEAmHDi6WoaL42DY7jCdS+Y4YPSCKX3VSqV83ILCdoMJp1WzPs8R a+RI7qify95RqBGNqTwmYnhA= X-Envelope-To: bpf@vger.kernel.org Received: by mta11.migadu.com with ESMTPS id 9e2c220236658063; Tue, 03 Nov 2026 03:24:11 +0000 X-Mizu-Trace-ID: 9e2c220236658063 X-Migadu-Flow: FLOW_OUT Date: Tue, 3 Nov 2026 11:24:02 +0800 From: Baoquan He To: Ridong Chen Cc: Steven Rostedt , Masami Hiramatsu , Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Dave Chinner , Mathieu Desnoyers , Muchun Song , Qi Zheng , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baolin Wang , David Hildenbrand , Lorenzo Stoakes , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, "open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)" , "open list:BPF [MISC]:Keyword:(?:b|_)bpf(?:b|_)" , Ridong Chen Subject: Re: [PATCH v5 2/6] mm/vmscan: move vmscan tracepoints to a local header Message-ID: References: <20261031090041.58574-1-ridong.chen@linux.dev> <20261031090041.58574-3-ridong.chen@linux.dev> <2f272a9b-ea83-4157-8968-0081990cb709@linux.dev> X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f272a9b-ea83-4157-8968-0081990cb709@linux.dev> On 11/02/26 at 06:46pm, Ridong Chen wrote: > > > On 11/2/2026 9:37 AM, Baoquan He wrote: > > On 10/31/26 at 05:00pm, Ridong Chen wrote: > > > From: Ridong Chen > > > > > > Move include/trace/events/vmscan.h to mm/trace_vmscan.h so that the > > > tracepoints can be extended to reference vmscan-internal structures such > > > as struct scan_control, which is not visible outside mm/. This mirrors > > > what several other subsystems already do with their trace headers (e.g. > > > fs/fuse/fuse_trace.h, fs/gfs2/trace_gfs2.h, fs/lockd/trace.h). As they > > > do, set TRACE_INCLUDE_PATH to "." and add mm/ to the include path of > > > vmscan.o, the only user that defines CREATE_TRACE_POINTS. > > > > > > No functional change. > > > > > > Signed-off-by: Ridong Chen > > > Reviewed-by: Barry Song > > > --- > > > MAINTAINERS | 2 ++ > > > mm/Makefile | 1 + > > > mm/shrinker.c | 2 +- > > > include/trace/events/vmscan.h => mm/trace_vmscan.h | 4 ++++ > > > mm/vmscan.c | 2 +- > > > 5 files changed, 9 insertions(+), 2 deletions(-) > > > rename include/trace/events/vmscan.h => mm/trace_vmscan.h (99%) > > > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > > index aaf2825ac945..2ad01107fa05 100644 > > > --- a/MAINTAINERS > > > +++ b/MAINTAINERS > > > @@ -17653,6 +17653,7 @@ F: Documentation/admin-guide/mm/multigen_lru.rst > > > F: Documentation/mm/multigen_lru.rst > > > F: include/linux/mm_inline.h > > > F: include/linux/mmzone.h > > > +F: mm/trace_vmscan.h > > > F: mm/vmscan.c > > > F: mm/workingset.c > > > @@ -17802,6 +17803,7 @@ R: Shakeel Butt > > > R: Lorenzo Stoakes > > > L: linux-mm@kvack.org > > > S: Maintained > > > +F: mm/trace_vmscan.h > > > F: mm/vmscan.c > > > F: mm/workingset.c > > > diff --git a/mm/Makefile b/mm/Makefile > > > index 2a3ec53d62ee..277b97f7f8d7 100644 > > > --- a/mm/Makefile > > > +++ b/mm/Makefile > > > @@ -32,6 +32,7 @@ KCOV_INSTRUMENT_vmstat.o := n > > > KCOV_INSTRUMENT_failslab.o := n > > > CFLAGS_init-mm.o += -Wno-override-init > > > +CFLAGS_vmscan.o += -I$(src) > > > > One nit: > > > > Does it really need the above line? It affects mm/shrinker.c too, did your > > shrinker.o building fail? > > > > Seems it's redundant because kbuild adds -I$(src) -I$(obj) for every object > > in the directory since commit cdd750bfb1f7 ("kbuild: remove 'addtree' and > > 'flags' magic for header search paths"). Please correct me if I am > > wrong. > > > > Hi Baoquan, > > Thanks for the review. > > The line is needed for vmscan.o, and mm/shrinker.c is fine without it, > because the two files include trace_vmscan.h in different ways. > > mm/shrinker.c only does a plain #include "trace_vmscan.h". The lookup > starts from mm/, where the header lives, so no -I is needed. > > mm/vmscan.c defines CREATE_TRACE_POINTS before including the header. > In that case , included at the end of > trace_vmscan.h, includes the header again to generate the tracepoint > definitions: > > #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) /* -> "./trace_vmscan.h" */ > > This #include is in include/trace/define_trace.h, so the lookup starts > from include/trace/ and only finds the header through -I. Without the > flag, vmscan.o fails to build: > > ./include/trace/define_trace.h:118:42: fatal error: ./trace_vmscan.h: No > such file or directory > > As for cdd750bfb1f7, it doesn't add -I$(src) for every build. kbuild > only adds -I$(src) -I$(obj) automatically when building with O= > (see "ifdef building_out_of_srctree" in scripts/Makefile.lib). So > with O= the line is indeed redundant and vmscan.o builds fine without > it, but a plain in-tree "make" fails with the error above. The > explicit flag keeps both working. > > To be honest, I had the same worry at first: I thought every .c file > that includes the header would need a Makefile change. That's why v3 > used a relative TRACE_INCLUDE_PATH (../../mm) instead. Steven corrected > me and pointed out that the proper way is TRACE_INCLUDE_PATH "." plus > -I$(src) for the one object that defines CREATE_TRACE_POINTS [1]. That > turned out to need only this one line. Thanks again to Steven for > that. You are right, my nit was wrong. Learned it from you, thanks for the detailed explanation. > > [1] https://lore.kernel.org/all/20261014124914.21c21559@gandalf.local.home/ > > > > Other than the nit, this patch looks good to me, > > > > Reviewed-by: Baoquan He > > > > Thanks. > > > mmu-y := nommu.o > > > mmu-$(CONFIG_MMU) := highmem.o memory.o mincore.o \ > > > diff --git a/mm/shrinker.c b/mm/shrinker.c > > > index 4fb424e721bc..4fbdade6d2f6 100644 > > > --- a/mm/shrinker.c > > > +++ b/mm/shrinker.c > > > @@ -3,7 +3,7 @@ > > > #include > > > #include > > > #include > > > -#include > > > +#include "trace_vmscan.h" > > > #include "internal.h" > > > diff --git a/include/trace/events/vmscan.h b/mm/trace_vmscan.h > > > similarity index 99% > > > rename from include/trace/events/vmscan.h > > > rename to mm/trace_vmscan.h > > > index 8a872990b4be..ad90f0e9bf2e 100644 > > > --- a/include/trace/events/vmscan.h > > > +++ b/mm/trace_vmscan.h > > > @@ -648,4 +648,8 @@ TRACE_EVENT(mm_vmscan_kswapd_clear_hopeless, > > > #endif /* _TRACE_VMSCAN_H */ > > > /* This part must be outside protection */ > > > +#undef TRACE_INCLUDE_FILE > > > +#undef TRACE_INCLUDE_PATH > > > +#define TRACE_INCLUDE_PATH . > > > +#define TRACE_INCLUDE_FILE trace_vmscan > > > #include > > > diff --git a/mm/vmscan.c b/mm/vmscan.c > > > index 9959ca158ce8..79d2d614afd0 100644 > > > --- a/mm/vmscan.c > > > +++ b/mm/vmscan.c > > > @@ -71,7 +71,7 @@ > > > #include "swap.h" > > > #define CREATE_TRACE_POINTS > > > -#include > > > +#include "trace_vmscan.h" > > > struct scan_control { > > > /* How many pages shrink_list() should reclaim */ > > > -- > > > 2.43.0 > > > > > -- > Best regards > Ridong >