From nobody Thu Sep 24 18:37:43 2026 Received: from mta1.migadu.com (out-57.mta1.migadu.com [95.215.58.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A897F492E40 for ; Mon, 21 Sep 2026 11:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.57 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789991202; cv=none; b=CZ0SPMbvSHpLdh5QavStrJqGuGAi1PEj25zw7WO+cO3nqQA66i0qclvZbN9HdP61oe67hhmjtKLboCU6/n9/asxIdOfyKwJ55ZHlOGQOCPEAMsfb6DLlopm5fAVWfABPuDgagEgSViuwQf2WW+GAI6K1rjKcl4ZcdXsuETWCW+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789991202; c=relaxed/simple; bh=jRoLHiXUjqgSCQI9swstc7I6QdyBDVBnU5RnGjj+W6U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JXOQqhba9DVK1cLaC3gGrkjednYgDGitSeNlOLv4/5K201pH0msBKJRhDquqBIc//BXHjo2lYd8sQjDk246SR5WpCpfEMT6NJuwOf9mcx+Uds1av5TwmQQjEGgCCZ0wGENg4cv7QphmuFdwQBlqw7wNfIo6399m7ylZCyA5t3MU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=J/UK/IiC; arc=none smtp.client-ip=95.215.58.57 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) header.d=linux.dev header.i=@linux.dev header.b="J/UK/IiC" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=jRoLHiXUjqgSCQI9swstc7I6QdyBDVBnU5RnGjj+W6U=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789991198; v=1; x=1790595998; b=J/UK/IiC5s+C6wAqG+lSel0+4AUh58am8QpK433Zn2jnlGo9EMJIsEBa7lkOlsKTQF7+E+2O wvfGVyNI+OmpmKDga0DDG3RDhWLGicLftzIK4VB6T0HqnfGudcKdRAUofJ0PdlTlNZASCilhwoF EoKxpd+5jM1llzAfUjiW+9BY= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 2b03a41349172853; Mon, 21 Sep 2026 11:46:38 +0000 X-Mizu-Trace-ID: 2b03a41349172853 X-Migadu-Flow: FLOW_OUT From: Ridong Chen To: Steven Rostedt , Masami Hiramatsu , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Andrew Morton , Dave Chinner Cc: Mathieu Desnoyers , Muchun Song , Qi Zheng , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Baolin Wang , David Hildenbrand , Lorenzo Stoakes , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, cgroups@vger.kernel.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), linux-mm@kvack.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), Ridong Chen , Ridong Chen Subject: [PATCH RFC 1/4] mm/memcontrol: drop unused vmscan tracepoint include Date: Mon, 21 Sep 2026 19:46:03 +0800 Message-Id: <20260921114606.3871820-2-ridong.chen@linux.dev> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260921114606.3871820-1-ridong.chen@linux.dev> References: <20260921114606.3871820-1-ridong.chen@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ridong Chen memcontrol.c includes but does not use any of the tracepoints or macros it defines: all tracepoints invoked here come from memcg.h and writeback.h. Removing the include still compiles cleanly. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ridong Chen --- mm/memcontrol.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 4d00748c8a5b..2a98c5ca46a6 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -77,8 +77,6 @@ #include #undef CREATE_TRACE_POINTS =20 -#include - struct cgroup_subsys memory_cgrp_subsys __read_mostly; EXPORT_SYMBOL(memory_cgrp_subsys); =20 --=20 2.34.1 From nobody Thu Sep 24 18:37:43 2026 Received: from mta0.migadu.com (out-149.mta0.migadu.com [91.218.175.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4D7A491595 for ; Mon, 21 Sep 2026 11:46:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.149 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789991214; cv=none; b=P2fKwC3msZex3DVlxM7N7yWNgyFjoz+YIaf5WD45jH6o8tSsllz9lLzsST0cEoHG0y0TfiDyfxCYYMcj/M+M+YRUEcjCVXDgyWlnfXDmPGeS/F8zOcilIWsSQNASekdQMknSwTHLbm+bAXOkVVat7FFEqUSpAdLkLbZWgdlOI0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789991214; c=relaxed/simple; bh=MtpBUFbzYu1oiksXdT+2b1TI1k9PS5Y6zJeNKYblZfY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lYDVi6ejKIiIm86eZ6kbHBg6fNVcSAX3lpl+xYjVmqSHzRwepcDlDtzxRA75LH9aoavuV66cEpKqbGBZfsPErsujD5e2zh9BERdrQwwh/EAPpZLYiLvW9exwwTC+RkthMnfnBOi/KDsYyx5UH5amD9gGtRpl4mhc9rQuTNcQ9s0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=CgvFSGfc; arc=none smtp.client-ip=91.218.175.149 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) header.d=linux.dev header.i=@linux.dev header.b="CgvFSGfc" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=MtpBUFbzYu1oiksXdT+2b1TI1k9PS5Y6zJeNKYblZfY=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789991206; v=1; x=1790596006; b=CgvFSGfc0f5mkgkhlKI3hvsEzJAbnIiw+COZbsZQYEmR1ZlbwrsbLB/EC7g/1KwaQzZzeudY YsWajDQ5z5xzq/2GEajOC0IQUYKIfd8F6bmOr3882exYnOjWWh9QKfhjZ21vao/wBYYhH89xT42 B5osjB2vIMC/fBOyOZh+LL6Q= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id a9ffc5cf04c1e7d3; Mon, 21 Sep 2026 11:46:46 +0000 X-Mizu-Trace-ID: a9ffc5cf04c1e7d3 X-Migadu-Flow: FLOW_OUT From: Ridong Chen To: Steven Rostedt , Masami Hiramatsu , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Andrew Morton , Dave Chinner Cc: Mathieu Desnoyers , Muchun Song , Qi Zheng , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Baolin Wang , David Hildenbrand , Lorenzo Stoakes , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, cgroups@vger.kernel.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), linux-mm@kvack.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), Ridong Chen , Ridong Chen Subject: [PATCH RFC 2/4] mm/vmscan: move vmscan tracepoints to a local header Date: Mon, 21 Sep 2026 19:46:04 +0800 Message-Id: <20260921114606.3871820-3-ridong.chen@linux.dev> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260921114606.3871820-1-ridong.chen@linux.dev> References: <20260921114606.3871820-1-ridong.chen@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/ext2, kernel/trace/trace_benchmark). No functional change. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ridong Chen --- MAINTAINERS | 2 ++ mm/shrinker.c | 2 +- include/trace/events/vmscan.h =3D> mm/trace_vmscan.h | 4 ++++ mm/vmscan.c | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) rename include/trace/events/vmscan.h =3D> mm/trace_vmscan.h (99%) diff --git a/MAINTAINERS b/MAINTAINERS index e26b963d4001..c1dbb35273c4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -17227,6 +17227,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 =20 @@ -17374,6 +17375,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 =20 diff --git a/mm/shrinker.c b/mm/shrinker.c index 7ec2a9704f6f..3c3e87c4b61c 100644 --- a/mm/shrinker.c +++ b/mm/shrinker.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include "trace_vmscan.h" =20 #include "internal.h" =20 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..c5d824fef554 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 */ =20 /* This part must be outside protection */ +#undef TRACE_INCLUDE_FILE +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH ../../mm +#define TRACE_INCLUDE_FILE trace_vmscan #include diff --git a/mm/vmscan.c b/mm/vmscan.c index 91295070ca33..0eb7fa8e1d43 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -71,7 +71,7 @@ #include "swap.h" =20 #define CREATE_TRACE_POINTS -#include +#include "trace_vmscan.h" =20 struct scan_control { /* How many pages shrink_list() should reclaim */ --=20 2.34.1 From nobody Thu Sep 24 18:37:43 2026 Received: from mta0.migadu.com (out-157.mta0.migadu.com [91.218.175.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E5F3492E21 for ; Mon, 21 Sep 2026 11:46:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789991221; cv=none; b=b1BuVqn1Uuw0R/fs5KgjNYb8oD11AGIuF6arnlP+sn6IZy5CjudscYeHXzzgHv36f3mYQqzJRfA7LLq9uO0AK2M4zN1vvIkNPWYyncrwMpKMaQWUjEjpCAedSdAdjWRafPGEZkqy7s6eckY52woE83wrxV5A5wZXBdG1H9hfqdY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789991221; c=relaxed/simple; bh=OhxhrbKLBotENqeglIYbgbCgzsQP2IEJ2k2gb4BjpUc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MKdMsuSajdREqw3BIfVsDZqBJGyJzCb89WdW0mkhOQnS2LihdSSHXcIVhw4oRzJM2PGhgE2jQZs3uUT7luYBkktChpXMUEr/VZnXbMeaw4uNob8ifTfPuyqj6lC6Gl8NCo0/bxS8nL0LaSw6EamaULKbuR8UnOWVFfuQmaVIbYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=oy9ctfqp; arc=none smtp.client-ip=91.218.175.157 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) header.d=linux.dev header.i=@linux.dev header.b="oy9ctfqp" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=OhxhrbKLBotENqeglIYbgbCgzsQP2IEJ2k2gb4BjpUc=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789991213; v=1; x=1790596013; b=oy9ctfqpv6m8GH/0H9CCnAf87+Pk8zU+1ER5Cz0YZSWrdy1ScDKv5KHaIdShJb4hQfBDvZ5S oQPZKPSpd+pmfEfpiL7a2WlPVKwBtcJ6g9U9Fl3n+euAH5CzYkO3aXbwGYQlF/3WbeliY82mZB6 48q+XKazpSeoSzwhBB99oGso= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 9d7bc3f172d5fd19; Mon, 21 Sep 2026 11:46:52 +0000 X-Mizu-Trace-ID: 9d7bc3f172d5fd19 X-Migadu-Flow: FLOW_OUT From: Ridong Chen To: Steven Rostedt , Masami Hiramatsu , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Andrew Morton , Dave Chinner Cc: Mathieu Desnoyers , Muchun Song , Qi Zheng , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Baolin Wang , David Hildenbrand , Lorenzo Stoakes , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, cgroups@vger.kernel.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), linux-mm@kvack.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), Ridong Chen , Ridong Chen Subject: [PATCH RFC 3/4] mm/vmscan: move struct scan_control to the local trace header Date: Mon, 21 Sep 2026 19:46:05 +0800 Message-Id: <20260921114606.3871820-4-ridong.chen@linux.dev> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260921114606.3871820-1-ridong.chen@linux.dev> References: <20260921114606.3871820-1-ridong.chen@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ridong Chen Now that the vmscan tracepoints live in mm/trace_vmscan.h, move struct scan_control there as well so the trace events can reference reclaim-internal state directly. The definition is wrapped in its own include guard because the trace header is re-read under TRACE_HEADER_MULTI_READ, while a C struct may only be defined once. No functional change. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ridong Chen --- mm/trace_vmscan.h | 115 ++++++++++++++++++++++++++++++++++++++++++++++ mm/vmscan.c | 108 ------------------------------------------- 2 files changed, 115 insertions(+), 108 deletions(-) diff --git a/mm/trace_vmscan.h b/mm/trace_vmscan.h index c5d824fef554..c8ac5d4e4043 100644 --- a/mm/trace_vmscan.h +++ b/mm/trace_vmscan.h @@ -9,8 +9,123 @@ #include #include #include +#include #include =20 +/* Guard the struct against define_trace.h's repeated inclusion. */ +#ifndef _MM_VMSCAN_INTERNAL_H +#define _MM_VMSCAN_INTERNAL_H + +struct scan_control { + /* How many pages shrink_list() should reclaim */ + unsigned long nr_to_reclaim; + + /* + * Nodemask of nodes allowed by the caller. If NULL, all nodes + * are scanned. + */ + const nodemask_t *nodemask; + + /* + * The memory cgroup that hit its limit and as a result is the + * primary target of this reclaim invocation. + */ + struct mem_cgroup *target_mem_cgroup; + + /* + * Scan pressure balancing between anon and file LRUs + */ + unsigned long anon_cost; + unsigned long file_cost; + + /* Swappiness value for proactive reclaim. Always use sc_swappiness()! */ + int *proactive_swappiness; + + /* Can active folios be deactivated as part of reclaim? */ +#define DEACTIVATE_ANON 1 +#define DEACTIVATE_FILE 2 + unsigned int may_deactivate:2; + unsigned int force_deactivate:1; + unsigned int skipped_deactivate:1; + + /* zone_reclaim_mode, boost reclaim */ + unsigned int may_writepage:1; + + /* zone_reclaim_mode */ + unsigned int may_unmap:1; + + /* zone_reclaim_mode, boost reclaim, cgroup restrictions */ + unsigned int may_swap:1; + + /* Not allow cache_trim_mode to be turned on as part of reclaim? */ + unsigned int no_cache_trim_mode:1; + + /* Has cache_trim_mode failed at least once? */ + unsigned int cache_trim_mode_failed:1; + + /* Proactive reclaim invoked by userspace */ + unsigned int proactive:1; + + /* + * Cgroup memory below memory.low is protected as long as we + * don't threaten to OOM. If any cgroup is reclaimed at + * reduced force or passed over entirely due to its memory.low + * setting (memcg_low_skipped), and nothing is reclaimed as a + * result, then go back for one more cycle that reclaims the protected + * memory (memcg_low_reclaim) to avert OOM. + */ + unsigned int memcg_low_reclaim:1; + unsigned int memcg_low_skipped:1; + + /* Shared cgroup tree walk failed, rescan the whole tree */ + unsigned int memcg_full_walk:1; + + unsigned int hibernation_mode:1; + + /* One of the zones is ready for compaction */ + unsigned int compaction_ready:1; + + /* There is easily reclaimable cold cache in the current node */ + unsigned int cache_trim_mode:1; + + /* The file folios on the current node are dangerously low */ + unsigned int file_is_tiny:1; + + /* Always discard instead of demoting to lower tier memory */ + unsigned int no_demotion:1; + + /* Allocation order */ + s8 order; + + /* Scan (total_size >> priority) pages at once */ + s8 priority; + + /* The highest zone to isolate folios for reclaim from */ + s8 reclaim_idx; + + /* This context's GFP mask */ + gfp_t gfp_mask; + + /* Incremented by the number of inactive pages that were scanned */ + unsigned long nr_scanned; + + /* Number of pages freed so far during a call to shrink_zones() */ + unsigned long nr_reclaimed; + + struct { + unsigned int dirty; + unsigned int congested; + unsigned int writeback; + unsigned int immediate; + unsigned int taken; + } nr; + + /* for recording the reclaimed slab by now */ + struct reclaim_state reclaim_state; +}; + +#endif /* _MM_VMSCAN_INTERNAL_H */ + #define RECLAIM_WB_ANON 0x0001u #define RECLAIM_WB_FILE 0x0002u #define RECLAIM_WB_MIXED 0x0010u diff --git a/mm/vmscan.c b/mm/vmscan.c index 0eb7fa8e1d43..2fd9b42f89d8 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -73,114 +73,6 @@ #define CREATE_TRACE_POINTS #include "trace_vmscan.h" =20 -struct scan_control { - /* How many pages shrink_list() should reclaim */ - unsigned long nr_to_reclaim; - - /* - * Nodemask of nodes allowed by the caller. If NULL, all nodes - * are scanned. - */ - const nodemask_t *nodemask; - - /* - * The memory cgroup that hit its limit and as a result is the - * primary target of this reclaim invocation. - */ - struct mem_cgroup *target_mem_cgroup; - - /* - * Scan pressure balancing between anon and file LRUs - */ - unsigned long anon_cost; - unsigned long file_cost; - - /* Swappiness value for proactive reclaim. Always use sc_swappiness()! */ - int *proactive_swappiness; - - /* Can active folios be deactivated as part of reclaim? */ -#define DEACTIVATE_ANON 1 -#define DEACTIVATE_FILE 2 - unsigned int may_deactivate:2; - unsigned int force_deactivate:1; - unsigned int skipped_deactivate:1; - - /* zone_reclaim_mode, boost reclaim */ - unsigned int may_writepage:1; - - /* zone_reclaim_mode */ - unsigned int may_unmap:1; - - /* zone_reclaim_mode, boost reclaim, cgroup restrictions */ - unsigned int may_swap:1; - - /* Not allow cache_trim_mode to be turned on as part of reclaim? */ - unsigned int no_cache_trim_mode:1; - - /* Has cache_trim_mode failed at least once? */ - unsigned int cache_trim_mode_failed:1; - - /* Proactive reclaim invoked by userspace */ - unsigned int proactive:1; - - /* - * Cgroup memory below memory.low is protected as long as we - * don't threaten to OOM. If any cgroup is reclaimed at - * reduced force or passed over entirely due to its memory.low - * setting (memcg_low_skipped), and nothing is reclaimed as a - * result, then go back for one more cycle that reclaims the protected - * memory (memcg_low_reclaim) to avert OOM. - */ - unsigned int memcg_low_reclaim:1; - unsigned int memcg_low_skipped:1; - - /* Shared cgroup tree walk failed, rescan the whole tree */ - unsigned int memcg_full_walk:1; - - unsigned int hibernation_mode:1; - - /* One of the zones is ready for compaction */ - unsigned int compaction_ready:1; - - /* There is easily reclaimable cold cache in the current node */ - unsigned int cache_trim_mode:1; - - /* The file folios on the current node are dangerously low */ - unsigned int file_is_tiny:1; - - /* Always discard instead of demoting to lower tier memory */ - unsigned int no_demotion:1; - - /* Allocation order */ - s8 order; - - /* Scan (total_size >> priority) pages at once */ - s8 priority; - - /* The highest zone to isolate folios for reclaim from */ - s8 reclaim_idx; - - /* This context's GFP mask */ - gfp_t gfp_mask; - - /* Incremented by the number of inactive pages that were scanned */ - unsigned long nr_scanned; - - /* Number of pages freed so far during a call to shrink_zones() */ - unsigned long nr_reclaimed; - - struct { - unsigned int dirty; - unsigned int congested; - unsigned int writeback; - unsigned int immediate; - unsigned int taken; - } nr; - - /* for recording the reclaimed slab by now */ - struct reclaim_state reclaim_state; -}; - #ifdef ARCH_HAS_PREFETCHW static inline void prefetchw_prev_lru_folio(struct folio *folio, struct list_head *base) --=20 2.34.1 From nobody Thu Sep 24 18:37:43 2026 Received: from mta1.migadu.com (out-88.mta1.migadu.com [95.215.58.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1486D492502 for ; Mon, 21 Sep 2026 11:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.88 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789991224; cv=none; b=raUPud47pX+oq8tB3GRiMj0SkmE6SEanj9Zx4SgNznzayvXdHThTbKq7vs7smFMywoDiS188QuJYjSghSAqEW6iFbYf/TzrPSY/R5m+UeGILSWaQtXGJdT/EDzSHIhlf6JZbUPkekvzK/DnDTMi71o3OndYtKKOPzUcCNbhUBEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789991224; c=relaxed/simple; bh=RS4wOY+QJioWn2TQk9dWx0Y0VJvp9GgHoELvPCPlwGQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kaV/DeDAJaXbv4vfV13WFSNjsiPlRHMcS1qNOR2A8ZZkyswxClhmsB/K1emDqNxofP2AZlx33g2dfl/GzQROYURvAyH0h1Uxob+BNFyORYfkbOMT+mUjHJzNnLSsqJrUMH8m4zZOIP5BM24hZ2ii4rFHi2r+gIWg+F6b8EOcmOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=jl4Nnb2D; arc=none smtp.client-ip=95.215.58.88 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) header.d=linux.dev header.i=@linux.dev header.b="jl4Nnb2D" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=RS4wOY+QJioWn2TQk9dWx0Y0VJvp9GgHoELvPCPlwGQ=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789991218; v=1; x=1790596018; b=jl4Nnb2Dy5EL9NNWbh8ffmRN3XuCFwvwlrenmQ6KQTBm3Mlk9b+FZWKMoGxQ7eSNSOiOz+3M vy70+G6di+SLND3geXfUSii8gl6236BWs+FPkMHhoNOyAuXyAFxlg6Q7lUuIpEnG9yRd+CVomBl 9fJ/dhTUXVWrX3kWwgxPSWvg= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id f94b05048a23a332; Mon, 21 Sep 2026 11:46:58 +0000 X-Mizu-Trace-ID: f94b05048a23a332 X-Migadu-Flow: FLOW_OUT From: Ridong Chen To: Steven Rostedt , Masami Hiramatsu , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Andrew Morton , Dave Chinner Cc: Mathieu Desnoyers , Muchun Song , Qi Zheng , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Baolin Wang , David Hildenbrand , Lorenzo Stoakes , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, cgroups@vger.kernel.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), linux-mm@kvack.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), Ridong Chen , Ridong Chen Subject: [PATCH RFC 4/4] mm/vmscan: pass scan_control to the reclaim-begin tracepoints Date: Mon, 21 Sep 2026 19:46:06 +0800 Message-Id: <20260921114606.3871820-5-ridong.chen@linux.dev> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260921114606.3871820-1-ridong.chen@linux.dev> References: <20260921114606.3871820-1-ridong.chen@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ridong Chen The reclaim-begin tracepoints describe the entry conditions of a reclaim invocation, which struct scan_control already carries. Now that the struct is visible from the trace header, pass sc directly and pick the fields out in TP_fast_assign instead of spelling out gfp_mask and order at every callsite. The exported event format is unchanged. No functional change. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ridong Chen --- mm/trace_vmscan.h | 24 ++++++++++++------------ mm/vmscan.c | 7 +++---- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/mm/trace_vmscan.h b/mm/trace_vmscan.h index c8ac5d4e4043..c9f16267c0a2 100644 --- a/mm/trace_vmscan.h +++ b/mm/trace_vmscan.h @@ -291,9 +291,9 @@ TRACE_EVENT(mm_vmscan_wakeup_kswapd, =20 DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template, =20 - TP_PROTO(gfp_t gfp_flags, int order, struct mem_cgroup *memcg), + TP_PROTO(struct scan_control *sc, struct mem_cgroup *memcg), =20 - TP_ARGS(gfp_flags, order, memcg), + TP_ARGS(sc, memcg), =20 TP_STRUCT__entry( __field( unsigned long, gfp_flags ) @@ -302,8 +302,8 @@ DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_temp= late, ), =20 TP_fast_assign( - __entry->gfp_flags =3D (__force unsigned long)gfp_flags; - __entry->order =3D order; + __entry->gfp_flags =3D (__force unsigned long)sc->gfp_mask; + __entry->order =3D sc->order; __entry->memcg_id =3D mem_cgroup_id(memcg); ), =20 @@ -317,17 +317,17 @@ DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_te= mplate, =20 DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_rec= laim_begin, =20 - TP_PROTO(gfp_t gfp_flags, int order, struct mem_cgroup *memcg), + TP_PROTO(struct scan_control *sc, struct mem_cgroup *memcg), =20 - TP_ARGS(gfp_flags, order, memcg) + TP_ARGS(sc, memcg) ); =20 #ifdef CONFIG_MEMCG DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_recl= aim_begin, =20 - TP_PROTO(gfp_t gfp_flags, int order, struct mem_cgroup *memcg), + TP_PROTO(struct scan_control *sc, struct mem_cgroup *memcg), =20 - TP_ARGS(gfp_flags, order, memcg) + TP_ARGS(sc, memcg) ); #endif /* CONFIG_MEMCG */ =20 @@ -664,9 +664,9 @@ TRACE_EVENT(mm_vmscan_lru_shrink_active, =20 TRACE_EVENT(mm_vmscan_node_reclaim_begin, =20 - TP_PROTO(int nid, int order, gfp_t gfp_flags), + TP_PROTO(int nid, struct scan_control *sc), =20 - TP_ARGS(nid, order, gfp_flags), + TP_ARGS(nid, sc), =20 TP_STRUCT__entry( __field(int, nid) @@ -676,8 +676,8 @@ TRACE_EVENT(mm_vmscan_node_reclaim_begin, =20 TP_fast_assign( __entry->nid =3D nid; - __entry->order =3D order; - __entry->gfp_flags =3D (__force unsigned long)gfp_flags; + __entry->order =3D sc->order; + __entry->gfp_flags =3D (__force unsigned long)sc->gfp_mask; ), =20 TP_printk("nid=3D%d order=3D%d gfp_flags=3D%s", diff --git a/mm/vmscan.c b/mm/vmscan.c index 2fd9b42f89d8..2fed83738b4b 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -6885,7 +6885,7 @@ unsigned long try_to_free_pages(struct zonelist *zone= list, int order, return 1; =20 set_task_reclaim_state(current, &sc.reclaim_state); - trace_mm_vmscan_direct_reclaim_begin(sc.gfp_mask, order, NULL); + trace_mm_vmscan_direct_reclaim_begin(&sc, NULL); =20 nr_reclaimed =3D do_try_to_free_pages(zonelist, &sc); =20 @@ -6926,7 +6926,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem= _cgroup *memcg, struct zonelist *zonelist =3D node_zonelist(numa_node_id(), sc.gfp_mask); =20 set_task_reclaim_state(current, &sc.reclaim_state); - trace_mm_vmscan_memcg_reclaim_begin(sc.gfp_mask, 0, memcg); + trace_mm_vmscan_memcg_reclaim_begin(&sc, memcg); noreclaim_flag =3D memalloc_noreclaim_save(); =20 nr_reclaimed =3D do_try_to_free_pages(zonelist, &sc); @@ -7882,8 +7882,7 @@ static unsigned long __node_reclaim(struct pglist_dat= a *pgdat, unsigned int noreclaim_flag; unsigned long pflags; =20 - trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, sc->order, - sc->gfp_mask); + trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, sc); =20 cond_resched(); psi_memstall_enter(&pflags); --=20 2.34.1