delayacct: track delays from thrashing cache pages
[muen/linux.git] / include / linux / delayacct.h
index 31c865d1842e88671d7f29534587311c479fb3e7..577d1b25fccdb08bcd152d1b2df3b26bbdc02864 100644 (file)
@@ -57,7 +57,12 @@ struct task_delay_info {
 
        u64 freepages_start;
        u64 freepages_delay;    /* wait for memory reclaim */
+
+       u64 thrashing_start;
+       u64 thrashing_delay;    /* wait for thrashing page */
+
        u32 freepages_count;    /* total count of memory reclaim */
+       u32 thrashing_count;    /* total count of thrash waits */
 };
 #endif
 
@@ -76,6 +81,8 @@ extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *);
 extern __u64 __delayacct_blkio_ticks(struct task_struct *);
 extern void __delayacct_freepages_start(void);
 extern void __delayacct_freepages_end(void);
+extern void __delayacct_thrashing_start(void);
+extern void __delayacct_thrashing_end(void);
 
 static inline int delayacct_is_task_waiting_on_io(struct task_struct *p)
 {
@@ -156,6 +163,18 @@ static inline void delayacct_freepages_end(void)
                __delayacct_freepages_end();
 }
 
+static inline void delayacct_thrashing_start(void)
+{
+       if (current->delays)
+               __delayacct_thrashing_start();
+}
+
+static inline void delayacct_thrashing_end(void)
+{
+       if (current->delays)
+               __delayacct_thrashing_end();
+}
+
 #else
 static inline void delayacct_set_flag(int flag)
 {}
@@ -182,6 +201,10 @@ static inline void delayacct_freepages_start(void)
 {}
 static inline void delayacct_freepages_end(void)
 {}
+static inline void delayacct_thrashing_start(void)
+{}
+static inline void delayacct_thrashing_end(void)
+{}
 
 #endif /* CONFIG_TASK_DELAY_ACCT */