aboutsummaryrefslogtreecommitdiffstats
path: root/block/bio.c
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2019-08-08 15:03:00 -0400
committerJens Axboe <axboe@kernel.dk>2019-08-14 08:50:01 -0600
commitb8e24a9300b0836a9d39f6b20746766b3b81f1bd (patch)
tree2b992e084f3e88eca44d34c427745fed595e6149 /block/bio.c
parentblk-mq: Fix memory leak in blk_mq_init_allocated_queue error handling (diff)
downloadlinux-dev-b8e24a9300b0836a9d39f6b20746766b3b81f1bd.tar.xz
linux-dev-b8e24a9300b0836a9d39f6b20746766b3b81f1bd.zip
block: annotate refault stalls from IO submission
psi tracks the time tasks wait for refaulting pages to become uptodate, but it does not track the time spent submitting the IO. The submission part can be significant if backing storage is contended or when cgroup throttling (io.latency) is in effect - a lot of time is spent in submit_bio(). In that case, we underreport memory pressure. Annotate submit_bio() to account submission time as memory stall when the bio is reading userspace workingset pages. Tested-by: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bio.c')
-rw-r--r--block/bio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/bio.c b/block/bio.c
index 24a496f5d2e2..54769659a434 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -806,6 +806,9 @@ void __bio_add_page(struct bio *bio, struct page *page,
bio->bi_iter.bi_size += len;
bio->bi_vcnt++;
+
+ if (!bio_flagged(bio, BIO_WORKINGSET) && unlikely(PageWorkingset(page)))
+ bio_set_flag(bio, BIO_WORKINGSET);
}
EXPORT_SYMBOL_GPL(__bio_add_page);