Delay accounting already measures the time a task spends in direct reclaim and waiting for swapin, but in low memory situations tasks spend can spend a significant amount of their time waiting on thrashing page cache. This isn't tracked right now. To know the full impact of memory contention on an individual task, measure the delay when waiting for a recently evicted active cache page to read back into memory. Also update tools/accounting/getdelays.c: [hannes@computer accounting]$ sudo ./getdelays -d -p 1 print delayacct stats ON PID 1 CPU count real total virtual total delay total delay average 50318 745000000 847346785 400533713 0.008ms IO count delay total delay average 435 122601218 0ms SWAP count delay total delay average 0 0 0ms RECLAIM count delay total delay average 0 0 0ms THRASHING count delay total delay average 19 12621439 0ms
Showing the changes to include/uapi/linux (1 of 5 files). Show all
Unified · Split
| @@ -34,7 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | */ |
| 35 | 35 | |
| 36 | 36 | |
| 37 | −#define TASKSTATS_VERSION 8 | |
| 37 | +#define TASKSTATS_VERSION 9 | |
| 38 | 38 | #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN |
| 39 | 39 | * in linux/sched.h */ |
| 40 | 40 | |
| @@ -164,6 +164,10 @@ struct taskstats { · 123 unmodified lines | ||
| 164 | 164 | /* Delay waiting for memory reclaim */ |
| 165 | 165 | __u64 freepages_count; |
| 166 | 166 | __u64 freepages_delay_total; |
| 167 | + | |
| 168 | + /* Delay waiting for thrashing page */ | |
| 169 | + __u64 thrashing_count; | |
| 170 | + __u64 thrashing_delay_total; | |
| 167 | 171 | }; |
| 168 | 172 | |
| 169 | 173 | |