linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jim Cromie <jim.cromie@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: david@redhat.com, Liam.Howlett@Oracle.com, linux-mm@kvack.org,
	Jim Cromie <jim.cromie@gmail.com>
Subject: [RFC PATCH 05/10] dyndbg: avoid _ddebug.site in ddebug_condense_sites
Date: Thu, 12 Oct 2023 13:47:06 -0600	[thread overview]
Message-ID: <20231012194711.3288031-6-jim.cromie@gmail.com> (raw)
In-Reply-To: <20231012194711.3288031-1-jim.cromie@gmail.com>

Modify the for-loop in ddebug_condense_sites() to walk thru both
vectors: descs, sites in parallel.

This requires a 2nd set of cursor variables (*_ds) that mark the
start-of-range in the sites vector for the intervals to be
dd_store_range()d.  So also rename the old cursors (*_dd) for better
consistency and readability.

This is a partial step.  It still uses the desc_*() macros to provide
the values, and the macros use the site pointer.  Next, we replace the
macros with site_*(), passing the *_ds vars.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 lib/dynamic_debug.c | 39 ++++++++++++++++++++++++---------------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 3dc17922a1d1..563d373224ba 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1426,32 +1426,41 @@ static void dd_store_range(struct maple_tree *mt, const struct _ddebug *start,
 		v4pr_info("  ok %s at %lx\n", val, first);
 }
 
+
 static void ddebug_condense_sites(struct _ddebug_info *di)
 {
-	struct _ddebug *cur, *funcp, *filep, *modp;
+	struct _ddebug_site *cur_ds, *func_ds, *file_ds, *mod_ds;
+	struct _ddebug      *cur_dd, *func_dd, *file_dd, *mod_dd;
 	int i;
 
-	funcp = filep = modp = di->descs;
-	for_each_boxed_vector(di, descs, num_descs, i, cur) {
+	cur_dd = func_dd = file_dd = mod_dd = di->descs;
+	cur_ds = func_ds = file_ds = mod_ds = di->sites;
+	i = 0;
+	for (; i < di->num_descs; i++, cur_dd++, cur_ds++) {
+
+		BUG_ON(site_function(cur_ds) != desc_function(cur_dd));
 
-		if (!strcmp(desc_function(cur), desc_function(funcp)))
+		if (!strcmp(desc_function(cur_dd), desc_function(func_dd)))
 			continue;
-		dd_store_range(&mt_funcs, funcp, cur, "func", desc_function(funcp));
-		funcp = cur;
+		dd_store_range(&mt_funcs, func_dd, cur_dd, "func", desc_function(func_dd));
+		func_dd = cur_dd;
+		func_ds = cur_ds;
 
-		if (!strcmp(desc_filename(cur), desc_filename(filep)))
+		if (!strcmp(desc_filename(cur_dd), desc_filename(file_dd)))
 			continue;
-		dd_store_range(&mt_files, filep, cur, "file", desc_filename(filep));
-		filep = cur;
+		dd_store_range(&mt_files, file_dd, cur_dd, "file", desc_filename(file_dd));
+		file_dd = cur_dd;
+		file_ds = cur_ds;
 
-		if (!strcmp(desc_modname(cur), desc_modname(modp)))
+		if (!strcmp(desc_modname(cur_dd), desc_modname(mod_dd)))
 			continue;
-		dd_store_range(&mt_mods, modp, cur, "mod", desc_modname(modp));
-		modp = cur;
+		dd_store_range(&mt_mods, mod_dd, cur_dd, "mod", desc_modname(mod_dd));
+		mod_dd = cur_dd;
+		mod_ds = cur_ds;
 	}
-	dd_store_range(&mt_funcs, funcp, cur, "func:", desc_function(funcp));
-	dd_store_range(&mt_files, filep, cur, "file:", desc_filename(filep));
-	dd_store_range(&mt_mods, modp, cur, "mod:", desc_modname(modp));
+	dd_store_range(&mt_funcs, func_dd, cur_dd, "func:", desc_function(func_dd));
+	dd_store_range(&mt_files, file_dd, cur_dd, "file:", desc_filename(file_dd));
+	dd_store_range(&mt_mods, mod_dd, cur_dd, "mod:", desc_modname(mod_dd));
 }
 
 /*
-- 
2.41.0



  parent reply	other threads:[~2023-10-12 19:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 19:47 [RFC PATCH 00/10] how to reclaim unneeded vmlinux memory ? Jim Cromie
2023-10-12 19:47 ` [RFC PATCH 01/10] dyndbg: prep to isolate 3 repetetive fields Jim Cromie
2023-10-12 19:47 ` [RFC PATCH 02/10] dyndbg: split __dyndbg_sites section out from __dyndbg Jim Cromie
2023-10-12 19:47 ` [RFC PATCH 03/10] dyndbg: add 2nd cursor pair to init-fn Jim Cromie
2023-10-12 19:47 ` [RFC PATCH 04/10] dyndbg: save _ddebug_site mod,file,func fields into maple-trees Jim Cromie
2023-10-12 19:47 ` Jim Cromie [this message]
2023-10-12 19:47 ` [RFC PATCH 06/10] dyndbg: add site_*() macros to avoid using _ddebug.site Jim Cromie
2023-10-12 19:47 ` [RFC PATCH 07/10] dyndbg: wire in __desc_*() functions Jim Cromie
2023-10-12 19:47 ` [RFC PATCH 08/10] dyndbg: drop _ddebug.site member Jim Cromie
2023-10-12 19:47 ` [RFC PATCH 09/10] dyndbg: add dd_clear_range to prune mtrees Jim Cromie
2023-10-12 19:47 ` [RFC PATCH 10/10] dyndbg: cache the dynamically generated prefixes per callsite Jim Cromie
2023-10-12 19:48 [RFC PATCH 00/10] how to reclaim unneeded vmlinux memory ? Jim Cromie
2023-10-12 19:48 ` [RFC PATCH 05/10] dyndbg: avoid _ddebug.site in ddebug_condense_sites Jim Cromie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231012194711.3288031-6-jim.cromie@gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=Liam.Howlett@Oracle.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox