mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
block: don't merge across cgroup boundaries if blkcg is enabled
commit 6b2b04590b51aa4cf395fcd185ce439cab5961dc upstream.
blk-iocost and iolatency are cgroup aware rq-qos policies but they didn't
disable merges across different cgroups. This obviously can lead to
accounting and control errors but more importantly to priority inversions -
e.g. an IO which belongs to a higher priority cgroup or IO class may end up
getting throttled incorrectly because it gets merged to an IO issued from a
low priority cgroup.
Fix it by adding blk_cgroup_mergeable() which is called from merge paths and
rejects cross-cgroup and cross-issue_as_root merges.
Signed-off-by: Tejun Heo <[email protected]>
Fixes: d706751215 ("block: introduce blk-iolatency io controller")
Cc: [email protected] # v4.19+
Cc: Josef Bacik <[email protected]>
Link: https://lore.kernel.org/r/Yi/eE/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
8d3a7b2064
commit
3f91687e6e
2 changed files with 28 additions and 0 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#include <linux/bio.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/blk-cgroup.h>
|
||||
|
||||
#include <trace/events/block.h>
|
||||
|
||||
|
|
@ -571,6 +572,9 @@ static inline unsigned int blk_rq_get_max_segments(struct request *rq)
|
|||
static inline int ll_new_hw_segment(struct request *req, struct bio *bio,
|
||||
unsigned int nr_phys_segs)
|
||||
{
|
||||
if (!blk_cgroup_mergeable(req, bio))
|
||||
goto no_merge;
|
||||
|
||||
if (blk_integrity_merge_bio(req->q, req, bio) == false)
|
||||
goto no_merge;
|
||||
|
||||
|
|
@ -662,6 +666,9 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
|
|||
if (total_phys_segments > blk_rq_get_max_segments(req))
|
||||
return 0;
|
||||
|
||||
if (!blk_cgroup_mergeable(req, next->bio))
|
||||
return 0;
|
||||
|
||||
if (blk_integrity_merge_rq(q, req, next) == false)
|
||||
return 0;
|
||||
|
||||
|
|
@ -885,6 +892,10 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
|
|||
if (rq->rq_disk != bio->bi_disk)
|
||||
return false;
|
||||
|
||||
/* don't merge across cgroup boundaries */
|
||||
if (!blk_cgroup_mergeable(rq, bio))
|
||||
return false;
|
||||
|
||||
/* only merge integrity protected bio into ditto rq */
|
||||
if (blk_integrity_merge_bio(rq->q, rq, bio) == false)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue