From: Yang Yang (CGEL ZTE) <yang.yang29@xxxxxxxxxx> PSI tracks the time system waiting for refaulting pages(or called thrashing) spent on submitting the IO[1]. Delayacct also tracks thrashing, but we failed to update it accordingly. And we then have the ability to detect re-entrance of thrashing accounting for delayacct[2], so we complete the accounting now. This will make the thrashing accounting more accurate specifically when device is congested or the submitting cgroup IO-throttled. [1] commit b8e24a9300b0 ("block: annotate refault stalls from IO submission") [2] commit 317bdccd67b2 ("delayacct: support re-entrance detection of thrashing accounting") Signed-off-by: Yang Yang (CGEL ZTE) <yang.yang29@xxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Ran Xiaokai (CGEL ZTE) <ran.xiaokai@xxxxxxxxxx> Cc: wangyong (CGEL ZTE) <wang.yong12@xxxxxxxxxx> --- block/blk-core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index a0d1104c5590..d722ead0557f 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -41,6 +41,7 @@ #include <linux/part_stat.h> #include <linux/sched/sysctl.h> #include <linux/blk-crypto.h> +#include <linux/delayacct.h> #define CREATE_TRACE_POINTS #include <trace/events/block.h> @@ -831,16 +832,19 @@ void submit_bio(struct bio *bio) /* * If we're reading data that is part of the userspace workingset, count - * submission time as memory stall. When the device is congested, or - * the submitting cgroup IO-throttled, submission can be a significant + * submission time as memory stall and delay. When the device is congested, + * or the submitting cgroup IO-throttled, submission can be a significant * part of overall IO time. */ if (unlikely(bio_op(bio) == REQ_OP_READ && bio_flagged(bio, BIO_WORKINGSET))) { unsigned long pflags; + bool in_thrashing; + delayacct_thrashing_start(&in_thrashing); psi_memstall_enter(&pflags); submit_bio_noacct(bio); + delayacct_thrashing_end(&in_thrashing); psi_memstall_leave(&pflags); return; } -- 2.25.1