Re: [RFC PATCH] LTTng instrumentation mm (updated)

Mathieu Desnoyers
2007-11-30T19:10:26Z

* Dave Hansen (haveblue@us.ibm.com) wrote:
> On Fri, 2007-11-30 at 12:05 -0500, Mathieu Desnoyers wrote:
> >
> >
> > Given a trace including :
> > - Swapfiles initially used
> > - multiple swapon/swapoff
> > - swap in/out events
> >
> > We would like to be able to tell which swap file the information has
> > been written to/read from at any given time during the trace.
>
> Oh, tracing is expected to be on at all times? I figured someone would
> encounter a problem, then turn it on to dig down a little deeper, then
> turn it off.
>

Yep, it can be expected to be on at all times, especially on production
systems using "flight recorder" tracing to record information in a
circular buffer, then dumping the buffers when some triggers (error
conditions) happens.

> As for why I care what is in /proc/swaps. Take a look at this:
>
> struct swap_info_struct *
> get_swap_info_struct(unsigned type)
> {
> return &swap_info[type];
> }
>
> Then, look at the proc functions:
>
> static void *swap_next(struct seq_file *swap, void *v, loff_t *pos)
> {
> struct swap_info_struct *ptr;
> struct swap_info_struct *endptr = swap_info + nr_swapfiles;
>
> if (v == SEQ_START_TOKEN)
> ptr = swap_info;
> ...
>
> I guess if that swap_info[] has any holes, we can't relate indexes in
> there right back to /proc/swaps, but maybe we should add some
> information so that we _can_.
>

The if (!(ptr->flags & SWP_USED) test in swap_next seems to skip the
unused swap_info entries.

Why should we care about get_swap_info_struct always returning a "used"
swap info struct ?

> -- Dave