From: Christoph Hellwig hch@lst.de
mainline inclusion from mainline-v6.1-rc1 commit 118f3663fbc658e9ad6165e129076981c7b685c5 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8BCRJ CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
PSI accounting is now done by the VM code, where it should have been since the beginning.
Signed-off-by: Christoph Hellwig hch@lst.de Acked-by: Johannes Weiner hannes@cmpxchg.org Link: https://lore.kernel.org/r/20220915094200.139713-6-hch@lst.de Signed-off-by: Jens Axboe axboe@kernel.dk Conflicts: block/bio.c block/blk-core.c Signed-off-by: Liu Shixin liushixin2@huawei.com --- block/bio.c | 8 -------- block/blk-core.c | 19 ------------------- fs/direct-io.c | 2 -- include/linux/blk_types.h | 1 - 4 files changed, 30 deletions(-)
diff --git a/block/bio.c b/block/bio.c index 8c64c93e96c8a..b28b6a51fb2cb 100644 --- a/block/bio.c +++ b/block/bio.c @@ -915,9 +915,6 @@ 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);
@@ -1108,9 +1105,6 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter) * fit into the bio, or are requested in @iter, whatever is smaller. If * MM encounters an error pinning the requested pages, it stops. Error * is returned only if 0 pages could be pinned. - * - * It's intended for direct IO, so doesn't do PSI tracking, the caller is - * responsible for setting BIO_WORKINGSET if necessary. */ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) { @@ -1136,8 +1130,6 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) if (is_bvec) bio_set_flag(bio, BIO_NO_PAGE_REF);
- /* don't account direct I/O as memory stall */ - bio_clear_flag(bio, BIO_WORKINGSET); return bio->bi_vcnt ? 0 : ret; } EXPORT_SYMBOL_GPL(bio_iov_iter_get_pages); diff --git a/block/blk-core.c b/block/blk-core.c index 4afdd568225bd..502284017da18 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -39,7 +39,6 @@ #include <linux/t10-pi.h> #include <linux/debugfs.h> #include <linux/bpf.h> -#include <linux/psi.h> #include <linux/sched/sysctl.h> #include <linux/blk-crypto.h>
@@ -1108,24 +1107,6 @@ blk_qc_t 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 - * part of overall IO time. - */ - if (unlikely(bio_op(bio) == REQ_OP_READ && - bio_flagged(bio, BIO_WORKINGSET))) { - unsigned long pflags; - blk_qc_t ret; - - psi_memstall_enter(&pflags); - ret = submit_bio_noacct(bio); - psi_memstall_leave(&pflags); - - return ret; - } - return submit_bio_noacct(bio); } EXPORT_SYMBOL(submit_bio); diff --git a/fs/direct-io.c b/fs/direct-io.c index 9dafbb07dd6a6..c64d4eb38995a 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -426,8 +426,6 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio) unsigned long flags;
bio->bi_private = dio; - /* don't account direct I/O as memory stall */ - bio_clear_flag(bio, BIO_WORKINGSET);
spin_lock_irqsave(&dio->bio_lock, flags); dio->refcount++; diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 1853ec569b72d..ca4243cb90741 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -291,7 +291,6 @@ enum { BIO_NO_PAGE_REF, /* don't put release vec pages */ BIO_CLONED, /* doesn't own data */ BIO_BOUNCED, /* bio is a bounce bio */ - BIO_WORKINGSET, /* contains userspace workingset pages */ BIO_QUIET, /* Make BIO Quiet */ BIO_CHAIN, /* chained bio, ->bi_remaining in effect */ BIO_REFFED, /* bio has elevated ->bi_cnt */