This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: About last_tsk in _stp_module_relocate


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]