public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/26296] New: delay script-global locking until required
@ 2020-07-23 15:40 fche at redhat dot com
  2020-07-24  5:22 ` Craig Ringer
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: fche at redhat dot com @ 2020-07-23 15:40 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=26296

            Bug ID: 26296
           Summary: delay script-global locking until required
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: fche at redhat dot com
  Target Milestone: ---

The scripting language promises atomic execution of handlers that read/write
global variables.  This is implemented by taking read/write locks as
appropriate, early in the probe handler prologue.  It has been repeatedly
observed that this causes perhaps unnecessary overheads (e.g. bug #7033).

We can imagine a change that could maintain the atomic semantics, but handle
the common pattern:

  global bar
  probe foo {
    if(condition) next;
    bar = $var
  }

where a pure filtering predicate that does not read global variables is
expected to frequently skip execution of the critical sections entirely.

Instead of emitting:

prologue:
   lock_all()
body:
   if(condition) goto epilogue;
   bar=$var
epilogue:
   unlock_all()

we could emit:

prologue:
   locked_p = false
body:
   if(condition) goto epilogue;
   if(!locked_p) lock_all(); locked_p = true;
   bar=$var
epilogue:
   if (locked_p) unlock_all()

IOW: defer locking to the first moment when any global is actually
read/written, tracking locked-ness in a new context local.  This would involve
only a small change to the translator, involving only context-free logic.  That
could
later be optimized to remove repeated checks/etc. over multiple global vars in
a control-flow / context aware way.

-- 
You are receiving this mail because:
You are the assignee for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-08-18 19:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23 15:40 [Bug translator/26296] New: delay script-global locking until required fche at redhat dot com
2020-07-24  5:22 ` Craig Ringer
2020-07-24 14:12   ` Arkady
2020-07-24  5:22 ` [Bug translator/26296] " craig at 2ndquadrant dot com
2020-07-24 14:12 ` arkady.miasnikov at gmail dot com
2020-08-04 19:59 ` fche at redhat dot com
2020-08-10  6:32   ` Craig Ringer
2020-08-10  6:33 ` craig at 2ndquadrant dot com
2020-08-18 19:06 ` fche at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).