Re: [PATCH] Markers - remove extra format argument

From: Masami Hiramatsu
Date: Fri Mar 28 2008 - 01:35:31 EST


Hi Mathieu,

Mathieu Desnoyers wrote:
> Denys Vlasenko <vda.linux@xxxxxxxxxxxxxx> :
>> In this call:
>>
>> (*__mark_##name.call) \
>> (&__mark_##name, call_private, \
>> format, ## args); \
>>
>> you make gcc allocate duplicate format string. You can use
>> &__mstrtab_##name[sizeof(#name)] instead since it holds the same string,
>> or drop ", format," above and "const char *fmt" from here:
>>
>> void (*call)(const struct marker *mdata, /* Probe wrapper */
>> void *call_private, const char *fmt, ...);
>>
>> since mdata->format is the same and all callees which need it can take it there.
>
> Very good point. I actually thought about dropping it, since it would
> remove an unnecessary argument from the stack. And actually, since I now
> have the marker_probe_cb sitting between the marker site and the
> callbacks, there is no API change required. Thanks :)

First of all, I'm very interested in the marker, and your patches look
useful for me.

By the way, could you tell me what the call_private is for?
In your patch, that is used only from special function below.

> @@ -1844,3 +1848,22 @@ int valid_swaphandles(swp_entry_t entry,
> *offset = ++toff;
> return nr_pages? ++nr_pages: 0;
> }
> +
> +void ltt_dump_swap_files(void *call_data)
> +{
> + int type;
> + struct swap_info_struct *p = NULL;
> +
> + mutex_lock(&swapon_mutex);
> + for (type = swap_list.head; type >= 0; type = swap_info[type].next) {
> + p = swap_info + type;
> + if ((p->flags & SWP_ACTIVE) != SWP_ACTIVE)
> + continue;
> + __trace_mark(0, statedump_swap_files, call_data,
> + "filp %p vfsmount %p dname %s",
> + p->swap_file, p->swap_file->f_vfsmnt,
> + p->swap_file->f_dentry->d_name.name);
> + }
> + mutex_unlock(&swapon_mutex);
> +}
> +EXPORT_SYMBOL_GPL(ltt_dump_swap_files);
>

However, I think call_data can be passed as an argument.
If so, I think you can also drop it, like this.

void (*call)(const struct marker *mdata, ...);


Best regards,

--
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@xxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/