Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp920422imm; Tue, 5 Jun 2018 06:35:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJNOSV9KJmnFhKnPe80ADDuPQm0xl7C/Qsb8o4aoJhE854RwvXadDj2BH3TsU68iv+Igh8P X-Received: by 2002:a17:902:6105:: with SMTP id t5-v6mr26329998plj.138.1528205700362; Tue, 05 Jun 2018 06:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528205700; cv=none; d=google.com; s=arc-20160816; b=wkDvF04fcPS5zs33jzIiRbfEWZnb8UBsPPTp2sMbCNk2RdfQJzGHdBJvdy4wWPLpES O5fCxhBtqUeAjodCgt5BWS9tQ9e43uLa4qXlrYLqNKN74PqtlAEBq52u08nORVbn42XR 17TGDodfHJOTzJHrYxVBs5PdhD8JlIxZSp2VfEh4LYOJ9Q6ZDx59TUBRxGrxUlkp8zNZ df8vvXs+oM9yNVm7lU2qe9B+zH0quNHN74y71vgkFMOVn5bFGrOPofhPc0yZwZ1Q9Qm2 vvIXS/Bfu+qPy1yp3s3wF+9p7q//9owSh6RQApupEq4izzOOS3nkp4lWvH5SmYgVGBqW ASlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=T2HOvKTBD5ZCOBGWZqeARamf+heWWL6jfbNnT9zxlh8=; b=TGwTkKgej9y+xpKoSl+Lko5uRLIq8TdCFlKn+CNOprYBO4K/kh2ficASQZxoF1UcgA RBLCUjQ60lp2+4pt4XAA5gAOGm4tSIqx93kP2rEXBXJ2+q2ebmByr6s0X4rbZ91ZMRJH kG74xWj1jRLmDFWCnuykJjyq8z6lxs++LnsBGw62s4rHuJHaUKNJ0puzxMQbMMJX4MT2 b0JRO7x/GHP8pyMYX1+W2OoN1IyOTjNsUbNhZ958fBQ6E5Q7mnfR+BsD2jAYeQ+QvToO g8hmtFWqljA/kc9DfcLmWUew4gF5Y7d3mk1Rr1R1tmUTIZleRBkr43tyzlZNpjR9WgCa GknA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=Wad96w9E; 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 b97-v6si50611220plb.135.2018.06.05.06.34.46; Tue, 05 Jun 2018 06:35:00 -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=Wad96w9E; 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 S1751941AbeFEN3y (ORCPT + 99 others); Tue, 5 Jun 2018 09:29:54 -0400 Received: from mail-qt0-f174.google.com ([209.85.216.174]:41855 "EHLO mail-qt0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751842AbeFEN3v (ORCPT ); Tue, 5 Jun 2018 09:29:51 -0400 Received: by mail-qt0-f174.google.com with SMTP id y20-v6so2344213qto.8 for ; Tue, 05 Jun 2018 06:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=T2HOvKTBD5ZCOBGWZqeARamf+heWWL6jfbNnT9zxlh8=; b=Wad96w9EICAvyxwFXAVummJRwysBBOsCMnZqfjryQVuBJumeL9a4DkO+sjo3ZCtdJ8 56wymsXQCdUWWdzhbduxlkIr/wXNgTjnZ9D9fRK00tBqpcTnLeI2Sv+1t3W4I/twWJAM IgeSGYDhJH6nqxBzMUmzHdszopb/QHLtVVhn4AobL7HY0wbuBPTRu2zSsJtvSNrRpRiU LUBmJu+QzZ10mtU7fSdvtgVJ7viux74N/sk3uIsKrH2c5JTX6Yriq3l2b3wXopIWn0OJ plBg7PI8SPtJF/wUJRknyLTEmJX9Z8MSvqr/tywzSeCmqQjVLBxQ7CR0JalwWvycmMcA ZrTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=T2HOvKTBD5ZCOBGWZqeARamf+heWWL6jfbNnT9zxlh8=; b=KFKf2s+iNySRAt0ugI8ruCbzzK6lXDxnyZMXW5RPTpVkzse3GcQAguHA9TJxkhaK56 bC1TgT+ylfVEA0BMzQIhWp9boduUeDzNhI9eAEu0Zekl8Nk4CLTNve5Njg28n/w98jje kowmaewL9xM8YXmzwwiPtCh5shIo73aerEdshiim7bP7euV8ShuV/FUJN4kKDQjFfdCI XfEmXV2j4kPMi/+Ad1bDVgzQQ4hAkGLcZ7UKQa6o5qRZNRuqmCyQ6w3Il5JOh7JlQfCB FnFw7QqgH1PQZugBdHOzm7L8iU7Kqf2Dgjz7DfK/uxJ/Ubiprg4pLynFGBjnjRh5hy2s 2oYw== X-Gm-Message-State: APt69E10U/xeVqPcFisg5LxsmsnbEIRTJzfyBkEd07f0JCFFGITjgTWC UbpYwy2RBm8ac+9VA2vQSl8xPw== X-Received: by 2002:a0c:c309:: with SMTP id f9-v6mr22762107qvi.104.1528205390685; Tue, 05 Jun 2018 06:29:50 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id p50-v6sm10672788qtf.48.2018.06.05.06.29.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 06:29:50 -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 Subject: [PATCH 00/13][V2] Introduce io.latency io controller for cgroups Date: Tue, 5 Jun 2018 09:29:35 -0400 Message-Id: <20180605132948.1664-1-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org v1->v2: - fix how we get the swap device for the page when doing the swap throttling. - add a bunch of comments how the throttling works. - move the documentation to cgroup-v2.txt - address the various other comments. ==== Original message ===== This series adds a latency based io controller for cgroups. It is based on the same concept as the writeback throttling code, which is watching the overall total latency of IO's in a given window and then adjusting the queue depth of the group accordingly. This is meant to be a workload protection controller, so whoever has the lowest latency target gets the preferential treatment with no thought to fairness or proportionality. It is meant to be work conserving, so as long as nobody is missing their latency targets the disk is fair game. We have been testing this in production for several months now to get the behavior right and we are finally at the point that it is working well in all of our test cases. With this patch we protect our main workload (the web server) and isolate out the system services (chef/yum/etc). This works well in the normal case, smoothing out weird request per second (RPS) dips that we would see when one of the system services would run and compete for IO resources. This also works incredibly well in the runaway task case. The runaway task usecase is where we have some task that slowly eats up all of the memory on the system (think a memory leak). Previously this sort of workload would push the box into a swapping/oom death spiral that was only recovered by rebooting the box. With this patchset and proper configuration of the memory.low and io.latency controllers we're able to survive this test with a at most 20% dip in RPS. There are a lot of extra patches in here to set everything up. The following are just infrastructure that should be relatively uncontroversial [PATCH 01/13] block: add bi_blkg to the bio for cgroups [PATCH 02/13] block: introduce bio_issue_as_root_blkg [PATCH 03/13] blk-cgroup: allow controllers to output their own stats The following simply allow us to tag swap IO and assign the appropriate cgroup to the bio's so we can do the appropriate accounting inside the io controller [PATCH 04/13] blk: introduce REQ_SWAP [PATCH 05/13] swap,blkcg: issue swap io with the appropriate context This is so that we can induce delays. The io controller mostly throttles based on queue depth, however for cases like REQ_SWAP/REQ_META where we cannot throttle without inducing a priority inversion we have a mechanism to "back charge" groups for this IO by inducing an artificial delay at user space return time. [PATCH 06/13] blkcg: add generic throttling mechanism [PATCH 07/13] memcontrol: schedule throttling if we are congested This is more moving things around and refactoring, Jens you may want to pay close attention to this to make sure I didn't break anything. [PATCH 08/13] blk-stat: export helpers for modifying blk_rq_stat [PATCH 09/13] blk-rq-qos: refactor out common elements of blk-wbt [PATCH 10/13] block: remove external dependency on wbt_flags [PATCH 11/13] rq-qos: introduce dio_bio callback And this is the meat of the controller and it's documentation. [PATCH 12/13] block: introduce blk-iolatency io controller [PATCH 13/13] Documentation: add a doc for blk-iolatency Jens, I'm sending this through your tree since it's mostly block related, however there are the two mm related patches, so if somebody from mm could weigh in on how we want to handle those that would be great. Thanks, Josef