[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231012194834.3288085-4-jim.cromie@gmail.com>
Date: Thu, 12 Oct 2023 13:48:27 -0600
From: Jim Cromie <jim.cromie@...il.com>
To: linux-kernel@...r.kernel.org, jbaron@...mai.com,
gregkh@...uxfoundation.org
Cc: david@...hat.com, lb@...ihalf.com, linux@...musvillemoes.dk,
joe@...ches.com, mcgrof@...nel.org, Liam.Howlett@...cle.com,
linux-mm@...ck.org, Jim Cromie <jim.cromie@...il.com>
Subject: [RFC PATCH 03/10] dyndbg: add 2nd cursor pair to init-fn
In dynamic_debug_init(), add 2nd cursor pair to walk the
__dyndbg_sites section in parallel with the __dyndbg section.
This avoids using the _ddebug.site pointer during initialization,
which is a 1st step towards dropping the member entirely, and reducing
the struct size and section footprint.
no functional change
Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
lib/dynamic_debug.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 0ad9f1bc00f0..51af6a75ae92 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1501,6 +1501,7 @@ static int __init dynamic_debug_init_control(void)
static int __init dynamic_debug_init(void)
{
+ struct _ddebug_site *site, *site_mod_start;
struct _ddebug *iter, *iter_mod_start;
int ret, i, mod_sites, mod_ct;
const char *modname;
@@ -1508,9 +1509,11 @@ static int __init dynamic_debug_init(void)
struct _ddebug_info di = {
.descs = __start___dyndbg,
+ .sites = __start___dyndbg_sites,
.classes = __start___dyndbg_classes,
.class_users = __start___dyndbg_class_users,
.num_descs = __stop___dyndbg - __start___dyndbg,
+ .num_sites = __stop___dyndbg_sites - __start___dyndbg_sites,
.num_classes = __stop___dyndbg_classes - __start___dyndbg_classes,
.num_class_users = __stop___dyndbg_class_users - __start___dyndbg_class_users,
};
@@ -1533,16 +1536,19 @@ static int __init dynamic_debug_init(void)
return 0;
}
+ site = site_mod_start = di.sites;
iter = iter_mod_start = __start___dyndbg;
modname = desc_modname(iter);
i = mod_sites = mod_ct = 0;
- for (; iter < __stop___dyndbg; iter++, i++, mod_sites++) {
+ for (; iter < __stop___dyndbg; iter++, site++, i++, mod_sites++) {
if (strcmp(modname, desc_modname(iter))) {
mod_ct++;
di.num_descs = mod_sites;
+ di.num_sites = mod_sites;
di.descs = iter_mod_start;
+ di.sites = site_mod_start;
ret = ddebug_add_module(&di, modname);
if (ret)
goto out_err;
@@ -1550,10 +1556,13 @@ static int __init dynamic_debug_init(void)
mod_sites = 0;
modname = desc_modname(iter);
iter_mod_start = iter;
+ site_mod_start = site;
}
}
di.num_descs = mod_sites;
+ di.num_sites = mod_sites;
di.descs = iter_mod_start;
+ di.sites = site_mod_start;
ret = ddebug_add_module(&di, modname);
if (ret)
goto out_err;
--
2.41.0
Powered by blists - more mailing lists