This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: discussion about registering task_finder in user space probing
- From: Mark Wielaard <mjw at redhat dot com>
- To: wenji dot huang at oracle dot com
- Cc: SystemTAP <systemtap at sources dot redhat dot com>
- Date: Tue, 24 Mar 2009 10:45:41 +0100
- Subject: Re: discussion about registering task_finder in user space probing
- References: <49C8A29C.6040503@oracle.com>
Hi Wenji,
On Tue, 2009-03-24 at 17:06 +0800, Wenji Huang wrote:
> I found our task_finder embedded in each stap_uprob_spec even it is
> same. That will cause many times registering similar task_finder.
> [...]
> for (i=0; i<220; i++) {
> struct stap_uprobe_spec *sups = & stap_uprobe_specs[i];
> probe_point = sups->pp;
> if (sups->finder.pathname) sups->finder.callback = &
> stap_uprobe_process_found;
> else if (sups->pathname) sups->finder.vm_callback = &
> stap_uprobe_vmchange_found;
> rc = stap_register_task_finder_target (& sups->finder);
> if (rc) break;
> }
> [snip]
>
> So we will have 220 times registering similar task_finder. I think
> the probe point is irrelevant to task_finder. Can we just keep only one
> and invoke callbacks to register all the stap_uprobes[i] once interested
> process found?
I was just looking at this since I am doing something similar on the
pr6866 branch (not just for uprobes, but also for utrace and itrace
probes). My idea was to have stap_register_task_finder_target ()
recognize when the callback is already registered for that particular
pathname/pid. stap_register_task_finder_target () already avoids
duplication when it sees an existing entry for pathname/pid. So where
there is now a
// Add this target to the callback list for this task.
list_add_tail(&new_tgt->callback_list, &tgt->callback_list_head);
We could do a lookup of whether the callback is already in the list and
only add it when it isn't already there. What do you think?
Cheers,
Mark