]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
blk-cgroup: turn on psi memstall stuff
authorJosef Bacik <jbacik@fb.com>
Tue, 9 Jul 2019 21:41:29 +0000 (14:41 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Jul 2019 15:00:57 +0000 (09:00 -0600)
With the psi stuff in place we can use the memstall flag to indicate
pressure that happens from throttling.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup.c

index 53b7bd4c7000c97ab6bae14ffd201a80e2672e94..8afa52b0d1486dccaf8e375ae55d8ea10c3c12e9 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/ctype.h>
 #include <linux/blk-cgroup.h>
 #include <linux/tracehook.h>
+#include <linux/psi.h>
 #include "blk.h"
 
 #define MAX_KEY_LEN 100
@@ -1587,6 +1588,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;
@@ -1613,11 +1615,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();
@@ -1627,6 +1626,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);
 }
 
 /**