@@ -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;
}