This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: About last_tsk in _stp_module_relocate
- From: Mark Wielaard <mjw at redhat dot com>
- To: Wenji Huang <wenji dot huang at oracle dot com>
- Cc: systemtap at sourceware dot org
- Date: Tue, 29 Dec 2009 08:35:12 +0100
- Subject: Re: About last_tsk in _stp_module_relocate
- References: <0651a92d-b229-450b-bd06-7d9525c82811@default>
On Mon, 2009-12-28 at 21:34 -0800, Wenji Huang wrote:
> Hi Mark,
>
> I only found reference of last_tsk in _stp_module_relocate, without setting value.
> Seems some code is missing.
Oops. Thanks for going over the code and noticing this.
The intention was to mimic the last and last_sec caching. So the
following should be added to set the last_tsk:
diff --git a/runtime/sym.c b/runtime/sym.c
index 06691dc..c72d930 100644
--- a/runtime/sym.c
+++ b/runtime/sym.c
@@ -127,6 +127,7 @@ static unsigned long _stp_module_relocate(const char *module
}
}
+ last_tsk = tsk;
for (i = 0; i < _stp_num_modules; i++) {
last = _stp_modules[i];
if (strcmp(module, last->name))
But I now remember that I added an XXX at the top of
_stp_module_relocate:
/* XXX This doesn't look thread safe XXX */
static struct _stp_module *last = NULL;
static struct _stp_section *last_sec;
static struct task_struct *last_tsk;
static unsigned long last_offset;
I wasn't sure _stp_module_relocate couldn't be called simultaneously
from different threads/cpus. If it can then this caching might not be
safe.
Cheers,
Mark