lkml.org 
[lkml]   [2008]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Markers - remove extra format argument
Hi Mathieu,

Mathieu Desnoyers wrote:
> Denys Vlasenko <vda.linux@googlemail.com> :
>> 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@redhat.com



\
 
 \ /
  Last update: 2008-03-28 06:37    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean