Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754406AbdLDQN6 (ORCPT ); Mon, 4 Dec 2017 11:13:58 -0500 Received: from mail-ve1eur01on0106.outbound.protection.outlook.com ([104.47.1.106]:64688 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753065AbdLDQNj (ORCPT ); Mon, 4 Dec 2017 11:13:39 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Subject: [PATCH 5/5] blkcg: Add cgroup file to configure 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:34 +0300 Message-ID: <151240401439.10164.661741658187634131.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: HE1PR0902CA0036.eurprd09.prod.outlook.com (2603:10a6:7:15::25) To HE1PR0801MB1338.eurprd08.prod.outlook.com (2603:10a6:3:39::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82ee1877-dbff-4308-27a2-08d53b31f9c0 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:G0TYKGxK4EuUcABjPBLssLIHvI/QlBp9TsoENGmpe1gAcfEGKzgovyiRSYvcvZ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x5HAWMsTB2hzyUNWt8Vx0T/qwMADclZLkA+xEtnF9DT9lrfurQNlmep18ttqiGr8+lsn8L/xWeMb3Av6m5IGy58zo91/2EFm5ifHsIuxY1or1r0z/ni1uxMfbh5Uzo35YtI4tASWC7UvLhfmuklUuAFg9si0zOFBqv5KchtDXRFyDdxV5DwaLMKCDiF2Xn7q691i4=;4:EMrW9tY7GNP+snZD5XWesnSCTykNxGoSBoYN95T8tptxxby+0mPv02euGTAv/pF3EEwf8biosN3z2dDOo6hjAzZOTO+rkz3l18zQ7lgkt/3Izj56bnUm8e+WrUOdsYC9gwKhDIK6SlxY0E5TV+xWn8MYPB8/8qStxPOiFUp/ElkQLCJp5Kx2ZNC0O+NanLnDH800uTHCKBguv0wNQZ8zf+BwVECKjikCp/GASlxGxtjz4Dt5wmAmoP500aN5U2WVdl9ck4NzsK3IdN0aHt66dQ== 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)(76176011)(8676002)(55016002)(81166006)(54356011)(8936002)(2906002)(50466002)(105586002)(101416001)(68736007)(2950100002)(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;S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ange-CrossTenant-OriginalArrivalTime: 04 Dec 2017 16:13:36.9224 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 82ee1877-dbff-4308-27a2-08d53b31f9c0 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: 1724 Lines: 70 Add a file to configure per-cgroup maximum number of available aio requests. Allow write the values, which are less then currently allocated numbers of requests. Show numbers of currently allocated and maximum available requests. Signed-off-by: Kirill Tkhai --- block/blk-cgroup.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 9cc6e9574946..dc5600ef4523 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -981,12 +981,52 @@ static int blkcg_print_stat(struct seq_file *sf, void *v) return 0; } +#ifdef CONFIG_AIO +static int blkcg_write_aio_max_nr(struct cgroup_subsys_state *css, + struct cftype *cftype, u64 val) +{ + struct blkcg *blkg = css_to_blkcg(css); + int ret = 0; + + percpu_down_read(&cgroup_threadgroup_rwsem); + spin_lock(&aio_nr_lock); + if (val >= blkg->blkg_aio_nr) + blkg->blkg_aio_max_nr = val; + else + ret = -EBUSY; + spin_unlock(&aio_nr_lock); + percpu_up_read(&cgroup_threadgroup_rwsem); + return ret; +} + +static int blkcg_show_aio_nrs(struct seq_file *sf, void *v) +{ + struct blkcg *blkg = css_to_blkcg(seq_css(sf)); + unsigned long max_nr, nr; + + spin_lock(&aio_nr_lock); + max_nr = blkg->blkg_aio_max_nr; + nr = blkg->blkg_aio_nr; + spin_unlock(&aio_nr_lock); + + seq_printf(sf, "used=%lu, max=%lu\n", nr, max_nr); + return 0; +} +#endif /* CONFIG_AIO */ + static struct cftype blkcg_files[] = { { .name = "stat", .flags = CFTYPE_NOT_ON_ROOT, .seq_show = blkcg_print_stat, }, +#ifdef CONFIG_AIO + { + .name = "aio_nr", + .write_u64 = blkcg_write_aio_max_nr, + .seq_show = blkcg_show_aio_nrs, + }, +#endif { } /* terminate */ };