Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754256AbdLDQNE (ORCPT ); Mon, 4 Dec 2017 11:13:04 -0500 Received: from mail-ve1eur01on0121.outbound.protection.outlook.com ([104.47.1.121]:48320 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752166AbdLDQM7 (ORCPT ); Mon, 4 Dec 2017 11:12:59 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Subject: [PATCH 0/5] blkcg: Limit maximum number of aio requests available for cgroup From: Kirill Tkhai To: axboe@kernel.dk, bcrl@kvack.org, viro@zeniv.linux.org.uk, tj@kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-aio@kvack.org, oleg@redhat.com, ktkhai@virtuozzo.com Date: Mon, 04 Dec 2017 19:12:51 +0300 Message-ID: <151240305010.10164.15584502480037205018.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR07CA0001.eurprd07.prod.outlook.com (2603:10a6:7:67::11) To HE1PR0801MB1338.eurprd08.prod.outlook.com (2603:10a6:3:39::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8079c9b9-04cb-4b7b-78b6-08d53b31dfba X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603286);SRVR:HE1PR0801MB1338; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1338;3:tBN05MAhO8gACLYNMEoTaMHG/Hgn1Q4U7fVCvuYD8QbtW1cyiM9jwNjae3lsWcwNIb6UKhRzsEzuhtZaJgnjfFr0eGb7sYiwsvHF8fgZoSD6SH7cvZaPwLub9bc5MW2bvrcvb1L/2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KkkkhBzd8C5vPgK4NOqKNLveBIqjt0AWKJcgco2uIbZMuEWgOiVR4ydh29l5UKjDiOSaRHXw6hagQGTAGZQotTHAy3pAYOGHhmNoZDnXhnKkzMd2OKXwLtmrSwTXiw=;4:BcGSZU5Z1sS1YZEfZWDbEfjSj3zWm8irrFApTDvmTmfp4WPLlowjcb9KaXf3nY9RFYVtwJYtCRAhtM8Vv9R7CLT3sew3WEcZEDaJvhbI+EzSnbirpMEuLhASE3pYFxD/1zTmQT+I89B3jVVZmoXJj8tgZJxS9JBf5nPuMy5IJ/KCbLbPwZ28ZGGt0O9XAGbJezBjA2F5/Vnk5CBuFCpjL4gte6UlVYqZ5kIO/2pIv7vCe/ulPZqpbChM1k65Qr/IEEeHLDAvtJnAJ2RLchYtGw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(3231022)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123562025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(201708071742011);SRVR:HE1PR0801MB1338;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:HE1PR0801MB1338; X-Forefront-PRVS: 051158ECBB X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(6069001)(366004)(376002)(346002)(189002)(199003)(8676002)(55016002)(81166006)(54356011)(8936002)(2906002)(50466002)(105586002)(101416001)(68736007)(86362001)(103116003)(53936002)(83506002)(81156014)(25786009)(61506002)(5660300001)(478600001)(6506006)(47776003)(6116002)(305945005)(66066001)(106356001)(33646002)(3846002)(7736002)(55236003)(16526018)(230700001)(2486003)(52116002)(23676004)(316002)(58126008)(7696005)(97736004)(189998001)(9686003);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB1338;H:localhost.localdomain;FPR:;SPF:None;PTR:InfoNoRec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xPBAjSxFgDVAgCWmVTT5YzXzM4kyAlD20jh0KTspDKHDeW1llYkIMbk3GiX9tN9BdciUEoRCCHtjqK2kpKjhVjsyuNaSojdsLtvkDYypy47aDjto2MnNuNH3VhUUzUPhVa5LafnE=;5:WQsb0/mQfubXIEQ8o/ZmVq2jS6wF8uFKZEwQjU2aDCbJSdd+wzDhXRsKqJsrBWRaoF7f2BbnYMCJgLrxIfSBIoSuyBRbNDzaCe8EQYliz9gy/Im9N6f8EqSmIo6EeEs7wAiFdmpinMoF097MqrSQYl5VymLhHdGmNULJiqLX6MA=;24:nbZfVIT2NwPlEcFcRJllBiNVdpqcpedbszKpmXW9zesCIs4Mz8tbLV8jl4NdQBRJJk66LPEkuZojdF6DOEQQylsacZv3qtB+GbhKSESAF7s=;7:7lH5A/VtrzmSeC1/USv8oqiO5SMcu5dEIDkMaN5FDn06daNhTAkpXcbq4WTnuo3Ktmb5AFmuzoVPdZhc+3KtGk7rzM9/NVvKs73KNan3iIQ9fZPuE7iYLkfA1SYwEcOsygxv+FEhX6OBcDL/i3kBV/5tBUCqjEZbenmi4vCGvtvjV5WaIVIabYTVtz1SO0TWbDW+1dxJu4SWxs3w38Chxajt0i9g1UhY/YtxK9jCefAEz1wwcg6SNPnKo8E/NKnC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1338;20:uFgxN/m5zIqfuyXWMXZlAgZoa4Q4TegvtfeuV0OHhz76LwbA1fOkvIr4FhRzq79TdW6pumAGEEzCD3pORFR/tBDvQvksQRzC/9DtgpsmjvJfdq7vWPvbB2TyP9V7BgfurzSCpqq3oAysjGnRMsBRDzt5pqNADPHN+ExnCCYeIjE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2017 16:12:53.2487 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8079c9b9-04cb-4b7b-78b6-08d53b31dfba X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1338 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1275 Lines: 35 Hi, this patch set introduces accounting aio_nr and aio_max_nr per blkio cgroup. It may be used to limit number of aio requests, which are available for a cgroup, and could be useful for containers. The accounting is hierarchical, and aio contexts, allocated in child cgroup, are accounted in parent cgroups too. Also, new cgroup file "io.aio_nr" is introduced. It's used to set cgroup aio requests limit, to show current limit and number of currenly occupied requests. Patches 1-3 are refactoring. Patch 4 is the place where the accounting actually introduced. Patch 5 adds "io.aio_nr" file. --- Kirill Tkhai (5): aio: Move aio_nr increment to separate function aio: Export aio_nr_lock and aio_max_nr initial value to include/linux/aio.h blkcg: Add blkcg::blkg_aio_nr and blkcg::blkg_aio_max_nr blkcg: Charge aio requests in blkio cgroup hierarchy blkcg: Add cgroup file to configure blkcg::blkg_aio_max_nr block/blk-cgroup.c | 88 +++++++++++++++++++++++++- fs/aio.c | 151 ++++++++++++++++++++++++++++++++++++++++---- include/linux/aio.h | 21 ++++++ include/linux/blk-cgroup.h | 4 + 4 files changed, 247 insertions(+), 17 deletions(-) -- Signed-off-by: Kirill Tkhai