[PATCH 20/63] dyndbg: drop premature optimization in ddebug_add_module

Louis Chauvet louis.chauvet at bootlin.com
Tue Feb 25 14:26:01 UTC 2025



Le 25/01/2025 à 07:45, Jim Cromie a écrit :
> The class_ct var was added to avoid 2 function calls, but to do this
> it loops over all the module's debug callsites to determine the count.
> But it doesn't really help, so remove it.
> 
> Signed-off-by: Jim Cromie <jim.cromie at gmail.com>

Hi Jim,

If you move the other patch earlier, can you also move this one before 
"for_subvec", so you don't change the same lines twice.

Reviewed-by: Louis Chauvet <louis.chauvet at bootlin.com>

Thanks,
Louis Chauvet

> ---
>   lib/dynamic_debug.c | 10 ++--------
>   1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index 067db504dd1d..16c9b752822b 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -1284,8 +1284,6 @@ static void ddebug_attach_user_module_classes(struct ddebug_table *dt,
>   static int ddebug_add_module(struct _ddebug_info *di, const char *modname)
>   {
>   	struct ddebug_table *dt;
> -	struct _ddebug *iter;
> -	int i, class_ct = 0;
>   
>   	if (!di->descs.len)
>   		return 0;
> @@ -1308,18 +1306,14 @@ static int ddebug_add_module(struct _ddebug_info *di, const char *modname)
>   
>   	INIT_LIST_HEAD(&dt->link);
>   
> -	for_subvec(i, iter, di, descs)
> -		if (iter->class_id != _DPRINTK_CLASS_DFLT)
> -			class_ct++;
> -
> -	if (class_ct && di->maps.len)
> +	if (di->maps.len)
>   		ddebug_attach_module_classes(dt, di);
>   
>   	mutex_lock(&ddebug_lock);
>   	list_add_tail(&dt->link, &ddebug_tables);
>   	mutex_unlock(&ddebug_lock);
>   
> -	if (class_ct && di->users.len)
> +	if (di->users.len)
>   		ddebug_attach_user_module_classes(dt, di);
>   
>   	vpr_info("%3u debug prints in module %s\n", di->descs.len, modname);

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



More information about the Intel-gfx-trybot mailing list