delayacct: track delays from thrashing cache pages
[muen/linux.git] / kernel / delayacct.c
index ca8ac2824f0b666d880154602f313db7e4112b42..2a12b988c7178a2ed2ed211745a8c3c4840f7955 100644 (file)
@@ -135,9 +135,12 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
        d->swapin_delay_total = (tmp < d->swapin_delay_total) ? 0 : tmp;
        tmp = d->freepages_delay_total + tsk->delays->freepages_delay;
        d->freepages_delay_total = (tmp < d->freepages_delay_total) ? 0 : tmp;
+       tmp = d->thrashing_delay_total + tsk->delays->thrashing_delay;
+       d->thrashing_delay_total = (tmp < d->thrashing_delay_total) ? 0 : tmp;
        d->blkio_count += tsk->delays->blkio_count;
        d->swapin_count += tsk->delays->swapin_count;
        d->freepages_count += tsk->delays->freepages_count;
+       d->thrashing_count += tsk->delays->thrashing_count;
        raw_spin_unlock_irqrestore(&tsk->delays->lock, flags);
 
        return 0;
@@ -169,3 +172,15 @@ void __delayacct_freepages_end(void)
                &current->delays->freepages_count);
 }
 
+void __delayacct_thrashing_start(void)
+{
+       current->delays->thrashing_start = ktime_get_ns();
+}
+
+void __delayacct_thrashing_end(void)
+{
+       delayacct_end(&current->delays->lock,
+                     &current->delays->thrashing_start,
+                     &current->delays->thrashing_delay,
+                     &current->delays->thrashing_count);
+}