aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/delayacct.h19
-rw-r--r--include/linux/sched.h4
-rw-r--r--kernel/delayacct.c13
-rw-r--r--mm/vmscan.c5
4 files changed, 41 insertions, 0 deletions
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index ab94bc083558..f352f06fa063 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -39,6 +39,8 @@ extern void __delayacct_blkio_start(void);
39extern void __delayacct_blkio_end(void); 39extern void __delayacct_blkio_end(void);
40extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *); 40extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *);
41extern __u64 __delayacct_blkio_ticks(struct task_struct *); 41extern __u64 __delayacct_blkio_ticks(struct task_struct *);
42extern void __delayacct_freepages_start(void);
43extern void __delayacct_freepages_end(void);
42 44
43static inline int delayacct_is_task_waiting_on_io(struct task_struct *p) 45static inline int delayacct_is_task_waiting_on_io(struct task_struct *p)
44{ 46{
@@ -107,6 +109,18 @@ static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
107 return 0; 109 return 0;
108} 110}
109 111
112static inline void delayacct_freepages_start(void)
113{
114 if (current->delays)
115 __delayacct_freepages_start();
116}
117
118static inline void delayacct_freepages_end(void)
119{
120 if (current->delays)
121 __delayacct_freepages_end();
122}
123
110#else 124#else
111static inline void delayacct_set_flag(int flag) 125static inline void delayacct_set_flag(int flag)
112{} 126{}
@@ -129,6 +143,11 @@ static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
129{ return 0; } 143{ return 0; }
130static inline int delayacct_is_task_waiting_on_io(struct task_struct *p) 144static inline int delayacct_is_task_waiting_on_io(struct task_struct *p)
131{ return 0; } 145{ return 0; }
146static inline void delayacct_freepages_start(void)
147{}
148static inline void delayacct_freepages_end(void)
149{}
150
132#endif /* CONFIG_TASK_DELAY_ACCT */ 151#endif /* CONFIG_TASK_DELAY_ACCT */
133 152
134#endif 153#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d22ffe06d0eb..42036ffe6b00 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -672,6 +672,10 @@ struct task_delay_info {
672 /* io operations performed */ 672 /* io operations performed */
673 u32 swapin_count; /* total count of the number of swapin block */ 673 u32 swapin_count; /* total count of the number of swapin block */
674 /* io operations performed */ 674 /* io operations performed */
675
676 struct timespec freepages_start, freepages_end;
677 u64 freepages_delay; /* wait for memory reclaim */
678 u32 freepages_count; /* total count of memory reclaim */
675}; 679};
676#endif /* CONFIG_TASK_DELAY_ACCT */ 680#endif /* CONFIG_TASK_DELAY_ACCT */
677 681
diff --git a/kernel/delayacct.c b/kernel/delayacct.c
index 10e43fd8b721..84b6782a2ce4 100644
--- a/kernel/delayacct.c
+++ b/kernel/delayacct.c
@@ -165,3 +165,16 @@ __u64 __delayacct_blkio_ticks(struct task_struct *tsk)
165 return ret; 165 return ret;
166} 166}
167 167
168void __delayacct_freepages_start(void)
169{
170 delayacct_start(&current->delays->freepages_start);
171}
172
173void __delayacct_freepages_end(void)
174{
175 delayacct_end(&current->delays->freepages_start,
176 &current->delays->freepages_end,
177 &current->delays->freepages_delay,
178 &current->delays->freepages_count);
179}
180
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 967d30ccd92b..26672c6cd3ce 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -38,6 +38,7 @@
38#include <linux/kthread.h> 38#include <linux/kthread.h>
39#include <linux/freezer.h> 39#include <linux/freezer.h>
40#include <linux/memcontrol.h> 40#include <linux/memcontrol.h>
41#include <linux/delayacct.h>
41 42
42#include <asm/tlbflush.h> 43#include <asm/tlbflush.h>
43#include <asm/div64.h> 44#include <asm/div64.h>
@@ -1316,6 +1317,8 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
1316 struct zone *zone; 1317 struct zone *zone;
1317 enum zone_type high_zoneidx = gfp_zone(sc->gfp_mask); 1318 enum zone_type high_zoneidx = gfp_zone(sc->gfp_mask);
1318 1319
1320 delayacct_freepages_start();
1321
1319 if (scan_global_lru(sc)) 1322 if (scan_global_lru(sc))
1320 count_vm_event(ALLOCSTALL); 1323 count_vm_event(ALLOCSTALL);
1321 /* 1324 /*
@@ -1396,6 +1399,8 @@ out:
1396 } else 1399 } else
1397 mem_cgroup_record_reclaim_priority(sc->mem_cgroup, priority); 1400 mem_cgroup_record_reclaim_priority(sc->mem_cgroup, priority);
1398 1401
1402 delayacct_freepages_end();
1403
1399 return ret; 1404 return ret;
1400} 1405}
1401 1406