Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp916346imm; Tue, 5 Jun 2018 06:31:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLP+rKBnM9dZOEJMox/HwAJMaS+Ym0LyuOgebyMua2PL+jKEvQlYiWoxFuB2bSRJBWFGRm2 X-Received: by 2002:a65:6008:: with SMTP id m8-v6mr4665207pgu.134.1528205510139; Tue, 05 Jun 2018 06:31:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528205510; cv=none; d=google.com; s=arc-20160816; b=FTWXsOENl/smS4CM5UOuwB6WOiqhiAC6b2KqN+j/cUBesPAKIwLzw0uZLbQPlUHZ4A SUBDaL/+uKRZTPc5C3yp1ch3uQsd2H2wd7mneJ04dJg/x85rgy/PHFnmDWDpL6iyWzGP 7z0ldkSAZzsvLykhfVQzvCt+2H7mmLTxa1iZ0k/LVmTCP/B8oIKXgL04BBtylSDiy4p0 k+UHifubDgDYq/b2lqafGkIHWrVHaakp/9LbJ6btTrcTMfgQh9wtVy0MdyupuRPMK9/N Ykwy68sZOkYbhcCyaCCSG3a3MG7kb7zNl50XJ37iIaLPDApy34YSDAJnT/U1O1rht7D2 Itaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=oGWHcF+I1FAb0T0RllTc5crNDw5hGehwQIUcOHp09k0=; b=Cua5zcKQrxZTzbHJ/FDGSdL8jc8ViXMVTus4c7gJplTTkSWayt3Swi2WnDm9rElgp8 gFgvslzubqxu1IZ1rmGsm2GNjBO0ZVik/rU+Zv2nqKoOkN6POIScvJ/wS2lV3Iv1enoW RaWsa54G8uHQTso5tdHb/EKtJjD8u3CVJEgruOdB/KhWaPuJ2+mO4liK2ajeo+LbE06v 1etoubF2ksG9ZpDoFWC/qAGPEQaDhodhbV604UVwf69SGoUjFNtKP8LYTD80JY1yPE0z cSx0vSXhVY2SZMzdt3pbfYNy20npZhzU48CPD/mma0Bq3/dglla08EvDu4e6IOYrXUGW KMMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=yfT7pPdl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y15-v6si8216560pgr.555.2018.06.05.06.31.35; Tue, 05 Jun 2018 06:31:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=yfT7pPdl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752109AbeFENaa (ORCPT + 99 others); Tue, 5 Jun 2018 09:30:30 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:41958 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752077AbeFENaK (ORCPT ); Tue, 5 Jun 2018 09:30:10 -0400 Received: by mail-qt0-f193.google.com with SMTP id y20-v6so2345635qto.8 for ; Tue, 05 Jun 2018 06:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oGWHcF+I1FAb0T0RllTc5crNDw5hGehwQIUcOHp09k0=; b=yfT7pPdl9t1R3b0MuPzIYyt7JGRe+rVIWQUiyIkTrLwhcJRuBcg22vWB6+TQFNM6JC abNzzKbxHYpE3PbjE54Brs9gGhC1HCQgfQoXKTUdqh87fqy7Fm3X+1XMKzZIyenGTE1C EO73/4tCeLBJHRKUG17J8ENpdJOVJWgA7AKQXsJ/1vn4fcxdaAR9nwugin8Aa/oknWK4 XNWz9LDGcpUeKhWA+X2JsyMwyKVhBeNxW9qInNe4EpYcoA9H8ofgXBim8CrkWsTnojal jM4nExFfILaFYj/65UCvTsyj/d/eERKju1jkzyyZBCiwY/mJK6/iw5NUsZMj08Ed8ZZY 84Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oGWHcF+I1FAb0T0RllTc5crNDw5hGehwQIUcOHp09k0=; b=mj23s5XJ002fEr2jmSm0SIElUhEVP3mcnHiGzcysY+HZAJqzxO0cptQaSrGKWF35fL wmYuosthCcC9Hk/CYtpjzoosmvmlbJoggm22CUiebXNENIVgc66KtBFQOYmzpecgbB6Z G9aoN0F8Vt1gxlRktY8MPJWkkrS1JxTrWj10K23uamnyS5afsAIQZ2kRxttUHnHxRL5a qO200TuNgHRTeGbMG5SME9MQzPFGd4tQ2D3IxsrX+Dha+h6XtT4I3tE9hKc7jmFz2aOR zY27mCpFaauQNmvJp0LxvjBU+RVIjt6Q1Hi/8L84tRRgtzhbA5THSJoMPabqu1hdunQs 9u2Q== X-Gm-Message-State: APt69E3c8jo6exyfWALDlSOqHqwASjzIfsshg3AE+9w7sMfHa5muHbtx pU0kaRAeHui79UP/R1ikrAL00g== X-Received: by 2002:a0c:9ccb:: with SMTP id j11-v6mr24201217qvf.58.1528205410175; Tue, 05 Jun 2018 06:30:10 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id a1-v6sm1463295qte.73.2018.06.05.06.30.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 06:30:09 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, kernel-team@fb.com, linux-block@vger.kernel.org, akpm@linux-foundation.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, tj@kernel.org, linux-fsdevel@vger.kernel.org Cc: Josef Bacik Subject: [PATCH 13/13] Documentation: add a doc for blk-iolatency Date: Tue, 5 Jun 2018 09:29:48 -0400 Message-Id: <20180605132948.1664-14-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180605132948.1664-1-josef@toxicpanda.com> References: <20180605132948.1664-1-josef@toxicpanda.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik A basic documentation to describe the interface, statistics, and behavior of io.latency. Signed-off-by: Josef Bacik --- Documentation/cgroup-v2.txt | 79 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/Documentation/cgroup-v2.txt b/Documentation/cgroup-v2.txt index 74cdeaed9f7a..f6684ec99720 100644 --- a/Documentation/cgroup-v2.txt +++ b/Documentation/cgroup-v2.txt @@ -51,6 +51,9 @@ v1 is available under Documentation/cgroup-v1/. 5-3. IO 5-3-1. IO Interface Files 5-3-2. Writeback + 5-3-3. IO Latency + 5-3-3-1. How IO Latency Throttling Works + 5-3-3-2. IO Latency Interface Files 5-4. PID 5-4-1. PID Interface Files 5-5. Device @@ -1395,6 +1398,82 @@ writeback as follows. vm.dirty[_background]_ratio. +IO Latency +~~~~~~~~~~ + +This is a cgroup v2 controller for IO workload protection. You provide a group +with a latency target, and if the average latency exceeds that target the +controller will throttle any peers that have a lower latency target than the +protected workload. + +The limits are only applied at the peer level in the hierarchy. This means that +in the diagram below, only groups A, B, and C will influence each other, and +groups D and F will influence each other. Group G will influence nobody. + + [root] + / | \ + A B C + / \ | + D F G + + +So the ideal way to configure this is to set io.latency in groups A, B, and C. +Generally you do not want to set a value lower than the latency your device +supports. Experiment to find the value that works best for your workload, start +at higher than the expected latency for your device and watch the total_lat_avg +value in io.stat for your workload group to get an idea of the latency you see +during normal operation. Use this value as a basis for your real setting, +setting at 10-15% higher than the value in io.stat. Experimentation is key here +because total_lat_avg is a running total, so is the "statistics" portion of +"lies, damned lies, and statistics." + +How IO Latency Throttling Works +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +io.latency is work conserving, so as long as everybody is meeting their latency +target the controller doesn't do anything. Once a group starts missing it's +target it begins throttling any peer group that has a higher target than itself. +This throttling takes 2 forms: + +- Queue depth throttling. This is the number of outstanding IO's a group is + allowed to have. We will clamp down relatively quickly, starting at no limit + and going all the way down to 1 IO at a time. + +- Artificial delay induction. There are certain types of IO that cannot be + throttled without possibly adversely affecting higher priority groups. This + includes swapping and metadata IO. These types of IO are allowed to occur + normally, however they are "charged" to the originating group. If the + originating group is being throttled you will see the use_delay and delay + fields in io.stat increase. The delay value is how many microseconds that are + being added to any process that runs in this group. Because this number can + grow quite large if there is a lot of swapping or metadata IO occurring we + limit the individual delay events to 1 second at a time. + +Once the victimized group starts meeting it's latency target again it will start +unthrottling any peer groups that were throttled previously. If the victimized +group simply stops doing IO the global counter will unthrottle appropriately. + +IO Latency Interface Files +~~~~~~~~~~~~~~~~~~~~~~~~~~ + + io.latency + This takes a similar format as the other controllers. + + "MAJOR:MINOR target=