Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754470AbdLDQNc (ORCPT ); Mon, 4 Dec 2017 11:13:32 -0500 Received: from mail-db5eur01on0112.outbound.protection.outlook.com ([104.47.2.112]:52512 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754134AbdLDQN0 (ORCPT ); Mon, 4 Dec 2017 11:13:26 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Subject: [PATCH 3/5] blkcg: Add blkcg::blkg_aio_nr and blkcg::blkg_aio_max_nr 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:13:18 +0300 Message-ID: <151240399812.10164.2619089470139011328.stgit@localhost.localdomain> In-Reply-To: <151240305010.10164.15584502480037205018.stgit@localhost.localdomain> References: <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: HE1PR07CA0002.eurprd07.prod.outlook.com (2603:10a6:7:67::12) To VI1PR0801MB1343.eurprd08.prod.outlook.com (2603:10a6:800:3b::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: edc9795d-5cc0-443e-a712-08d53b31f0a1 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603286);SRVR:VI1PR0801MB1343; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB1343;3:GJyQkCOMe9ZPXl6oVwm4CrpI3UsioNQvTdAiyxQGtFITPWbzZpU35k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lh8bD+rvg7LQSO3tFSeKpJnIvK5dZ+ka4kKfFbRPEgRRvGIBVK4Eu+E5tGl9OQz11/GYK4eoxJYCiscxCSk0DGBG6MZlN/H1M6zU8vuzmvB76rjXC5Rd5ZmfaLxVFTeDCUpx48umgerez0+vra4DFET8MA2EPf884891GT86n49jE9RbKz8ISAvYcWW9x9FEOMCK0o=;4:jZE+gJR/o5SK9hAlipI6CihYf/EOxOAHr4x/A1uT3kScKD9au3/gBJblZACgwfqpqKVy24C4wlpNw3SXPAy2N/lMfqzsmJaF3rCEvHTBfT6joaAqpH0TbBX2z36Ggs0ocBiIET+J+/gdAmqdI3y0ETV/T1TOHCPJV1/968SyAEmAzEcre1F3rRu8i8it22RO3LHD5W0VxPsNmZMWhRmup+l73QZAYMpJbm4VcvN5z1eiP4ZH1lfmHvOwYF5QlTtvC8eFc5vfPQn2Y51y377SXA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231022)(3002001)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148)(201708071742011);SRVR:VI1PR0801MB1343;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:VI1PR0801MB1343; X-Forefront-PRVS: 051158ECBB X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(6009001)(376002)(366004)(346002)(199003)(189002)(86362001)(50466002)(106356001)(47776003)(66066001)(105586002)(33646002)(61506002)(316002)(23676004)(58126008)(103116003)(16526018)(6506006)(97736004)(2906002)(55016002)(76176011)(54356011)(7696005)(52116002)(2486003)(7736002)(81156014)(53936002)(9686003)(189998001)(6666003)(2950100002)(230700001)(5660300001)(81166006)(8676002)(305945005)(6116002)(3846002)(478600001)(25786009)(8936002)(55236003)(83506002)(68736007)(101416001);DI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Tb5GzijwbjQsKFwKRsG8ZlnpBmiARMTuIs= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2017 16:13:21.1855 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: edc9795d-5cc0-443e-a712-08d53b31f0a1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1343 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2746 Lines: 94 This adds new members of struct blkcg, which will be used to account numbers of cgroup's aio requests. Also, blkcg_root is used to store sysctl variables aio_nr and aio_max_nr. Signed-off-by: Kirill Tkhai --- block/blk-cgroup.c | 4 ++++ fs/aio.c | 2 ++ include/linux/aio.h | 6 ++++++ include/linux/blk-cgroup.h | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index d3f56baee936..774560469b01 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "blk.h" #define MAX_KEY_LEN 100 @@ -1101,6 +1102,9 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css) INIT_HLIST_HEAD(&blkcg->blkg_list); #ifdef CONFIG_CGROUP_WRITEBACK INIT_LIST_HEAD(&blkcg->cgwb_list); +#endif +#ifdef CONFIG_AIO + blkcg->blkg_aio_max_nr = parent_css ? AIO_NR_INF : AIO_NR_DEF; #endif list_add_tail(&blkcg->all_blkcgs_node, &all_blkcgs); diff --git a/fs/aio.c b/fs/aio.c index 9dc98a29077c..755f97a42ebe 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -189,10 +189,12 @@ struct aio_kiocb { }; DEFINE_SPINLOCK(aio_nr_lock); +#ifndef CONFIG_BLK_CGROUP /*------ sysctl variables----*/ unsigned long aio_nr; /* current system wide number of aio requests */ unsigned long aio_max_nr = AIO_NR_DEF; /* system wide maximum number of aio requests */ /*----end sysctl variables---*/ +#endif static struct kmem_cache *kiocb_cachep; static struct kmem_cache *kioctx_cachep; diff --git a/include/linux/aio.h b/include/linux/aio.h index 5dda2663802f..de929a8c9c59 100644 --- a/include/linux/aio.h +++ b/include/linux/aio.h @@ -2,6 +2,7 @@ #ifndef __LINUX__AIO_H #define __LINUX__AIO_H +#include #include struct kioctx; @@ -26,8 +27,13 @@ static inline void kiocb_set_cancel_fn(struct kiocb *req, kiocb_cancel_fn *cancel) { } #endif /* CONFIG_AIO */ +#if !defined(CONFIG_BLK_CGROUP) || !defined(CONFIG_AIO) /* for sysctl: */ extern unsigned long aio_nr; extern unsigned long aio_max_nr; +#else +#define aio_nr blkcg_root.blkg_aio_nr +#define aio_max_nr blkcg_root.blkg_aio_max_nr +#endif /* !CONFIG_BLK_CGROUP || !CONFIG_AIO */ #endif /* __LINUX__AIO_H */ diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 8bbc3716507a..3d9c176fc173 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -55,6 +55,10 @@ struct blkcg { #ifdef CONFIG_CGROUP_WRITEBACK struct list_head cgwb_list; #endif +#ifdef CONFIG_AIO + unsigned long blkg_aio_nr; + unsigned long blkg_aio_max_nr; +#endif }; /*