From df56e1cfc74d185771f5bcce72ae8c72aa85f72b Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Tue, 9 Jul 2019 14:41:29 -0700 Subject: [PATCH 0082/2944] blk-cgroup: turn on psi memstall stuff commit fd112c74652371a023f85d87b70bee7169e8f4d0 upstream. With the psi stuff in place we can use the memstall flag to indicate pressure that happens from throttling. Signed-off-by: Josef Bacik Signed-off-by: Tejun Heo Signed-off-by: Jens Axboe Signed-off-by: Joseph Qi Acked-by: Caspar Zhang --- block/blk-cgroup.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index a06547f..e8ad956 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "blk.h" #define MAX_KEY_LEN 100 @@ -1677,6 +1678,7 @@ static void blkcg_scale_delay(struct blkcg_gq *blkg, u64 now) */ static void blkcg_maybe_throttle_blkg(struct blkcg_gq *blkg, bool use_memdelay) { + unsigned long pflags; u64 now = ktime_to_ns(ktime_get()); u64 exp; u64 delay_nsec = 0; @@ -1703,11 +1705,8 @@ static void blkcg_maybe_throttle_blkg(struct blkcg_gq *blkg, bool use_memdelay) */ delay_nsec = min_t(u64, delay_nsec, 250 * NSEC_PER_MSEC); - /* - * TODO: the use_memdelay flag is going to be for the upcoming psi stuff - * that hasn't landed upstream yet. Once that stuff is in place we need - * to do a psi_memstall_enter/leave if memdelay is set. - */ + if (use_memdelay) + psi_memstall_enter(&pflags); exp = ktime_add_ns(now, delay_nsec); tok = io_schedule_prepare(); @@ -1717,6 +1716,9 @@ static void blkcg_maybe_throttle_blkg(struct blkcg_gq *blkg, bool use_memdelay) break; } while (!fatal_signal_pending(current)); io_schedule_finish(tok); + + if (use_memdelay) + psi_memstall_leave(&pflags); } /** -- 1.8.3.1