This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: analysis of polling in systemtap
- From: Mathieu Desnoyers <compudj at krystal dot dyndns dot org>
- To: Martin Hunt <hunt at redhat dot com>
- Cc: "systemtap at sources dot redhat dot com" <systemtap at sources dot redhat dot com>
- Date: Fri, 16 Dec 2005 15:18:46 -0500
- Subject: Re: analysis of polling in systemtap
- References: <1134762840.3952.49.camel@monkey2>
* 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