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: analysis of polling in systemtap


* Martin Hunt (hunt@redhat.com) wrote:
> For this report, when I say "polling", I mean a systemtap script that
> has a timer firing at fixed intervals so it can print out updated data.
> Commonly this is done like so
> 
> probe timer.ms(1000)
> {
>  # clear screen
>  # sort data
>  # print top 'n' pieces of data
> }
> 
> This timer probe presents implementation problems because on an MP
> system, while the timer probe is printing data, kprobes may be firing
> trying to update the data. We do things to minimize the problem, however
> it is unavoidable that data will sometimes get dropped. Currently this
> is a fatal situation, with an error printed and the script terminated.
> "ERROR: locking timeout over variable global_called"
>

You could also keep two arrays for your data. Your poller would first atomically
switch the pointer to the "empty" array before doing its sorting of the "full"
array. Once the pointer is changed, just wait until every writer to the "full"
array has finished (you might want to use a small lock for this, or RCU of your
timer can wait (if it's a thread)) and then play freely with your data.

Mathieu

OpenPGP public key:              http://krystal.dyndns.org:8080/key/compudj.gpg
Key fingerprint:     8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68 


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