From patchwork Mon Nov 19 10:34:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 151468 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2489779ljp; Mon, 19 Nov 2018 02:34:43 -0800 (PST) X-Google-Smtp-Source: AJdET5fq8s6TBf8434sq72CBK5L0dqmIsZUsnxbEEazh5UzmFOfl/vT+cHxPapHu+8q03+N8jU3k X-Received: by 2002:a63:dc0c:: with SMTP id s12mr19791116pgg.398.1542623683510; Mon, 19 Nov 2018 02:34:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542623683; cv=none; d=google.com; s=arc-20160816; b=Y1GCE6uZrybviFWnlDjtIPxer3YmAWV1NEpJh5yW/y5WeLWgXDftRVe0Sy3bv1XkfC 1Sb522TanFNRrcsLHDBU5da407dKBoBrFjAG7B+/YBBawpM+C6poWzRgoBagflPOjiNi aCF/JIMCObBqM6MPNbXI+GZYdOssOsIPv/ltWUdTEU0a4kyiUyduCge9YJVQOlBat0CB hI/eiEb4EfvLu97kbLCIodE0UZZJfshBahsO16tDSF1mHZUZt4zKC5Coa2MK+O8FVpRW FuvXMTuDcCiY8/VcekoOzJo3YoEYURraxidLqprQp2YAwd3AqS4h/CVtcFnGgPCauYRj ok9A== 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; bh=LmkQD0tbtsZAukIf+hDcnldAyNR4PdixWTebwHtfE1o=; b=tihK072xl+d+WMy+He5fI1x8oG68bj6iQ08Pidu2LLZ61D3frhOU91KJ3kZiMB45pa hd00UIQs+UvNvOqpIbxvpRFjaSXxKEzD0F9iqRvmGUTQvxNWqbuJl7RSf/eDRE8dpMQv NuImvVf2tCMU6K5biYE8CCxlTecUdxnGTlqMqouoYzri1DEsM75NiU5Am3f1IdIr09vK 9XXW90Vtyx9s6M90OvF2PPxqUFpNp25WqH4Qe6luo3P5STp2aX4kNIUCelD8AK9M3mom lefWxGItbBXfbwU9kwpGNaTAZvQBN1ZQq5B8AMDcFuN1GCBGweahKZ8671ISs3RctlJW C0KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AaxJv2p3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 189si37525025pgh.320.2018.11.19.02.34.42; Mon, 19 Nov 2018 02:34:43 -0800 (PST) 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=@linaro.org header.s=google header.b=AaxJv2p3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728127AbeKSU5x (ORCPT + 32 others); Mon, 19 Nov 2018 15:57:53 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38351 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727992AbeKSU5w (ORCPT ); Mon, 19 Nov 2018 15:57:52 -0500 Received: by mail-wr1-f66.google.com with SMTP id e3-v6so31457479wrs.5 for ; Mon, 19 Nov 2018 02:34:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LmkQD0tbtsZAukIf+hDcnldAyNR4PdixWTebwHtfE1o=; b=AaxJv2p3JFx65im37SGV+IZMjQz1PPfDkb8OcXtv8JDpUPSwtJZtW84/AKZepCQe+C N6ByZWMq30fbYPq9WLjLvcq+3L+10BQzWw1OW1Pt/d9MWCFPc6NjMm4cKoRYnUAPMnD9 s0GJUK1te5M31nWFXEdF1uRlg/3TqiSkMp1y0= 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=LmkQD0tbtsZAukIf+hDcnldAyNR4PdixWTebwHtfE1o=; b=mqFPIIDVbQFzL3/b9/RD7lo9KkDtQpRUjXSvCJDOBmZNzBk+8qfNOe4cY0Ta/b6uaW nxGwGu15jiJVsiByEZkV2WDFH3sJhZLZXKYJPrFNlpN+pG1RBxgmDZ/FwWL+TEQuqbh/ 9aZRQm6RJbUGFacVnbcMm2xQAcI599twauq8qrKa8Oz/NVpmm04VRIBZTbd2C1MH5u0s /Oz19wVPTkXag54BhZ3oGUy45cDXRQZPRMrmxUEQrkzWY9Zemm6Ez8rGA3BZvPA02stO KQDd9yz2tcSiV45N4+3QY15cMKv/4SnAeyqpSF+Ms/0q6P3w6rHLCMmIMBRQwh19jZag q0/A== X-Gm-Message-State: AA+aEWa08TAzC3+SYOWZAxIrVxkCRW596sUzl6FKvyDVGVwD036VGgC9 T8RCW9tUDZ9dHNDw2LpOwkO4Og== X-Received: by 2002:adf:a743:: with SMTP id e3mr4979481wrd.56.1542623677866; Mon, 19 Nov 2018 02:34:37 -0800 (PST) Received: from localhost.localdomain ([37.162.18.180]) by smtp.gmail.com with ESMTPSA id e9sm14973298wro.16.2018.11.19.02.34.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:34:37 -0800 (PST) From: Paolo Valente To: Jens Axboe , Greg Kroah-Hartman , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Paolo Valente Subject: [PATCH V2 01/10] cgroup: add hook seq_show_cft with also the owning cftype as parameter Date: Mon, 19 Nov 2018 11:34:15 +0100 Message-Id: <20181119103424.3853-2-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181119103424.3853-1-paolo.valente@linaro.org> References: <20181119103424.3853-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current implementation of the seq_show hook in the cftype struct has only, as parameters, the seq_file to write to and the arguments passed by the command line. Thus, the only way to retrieve the cftype that owns an instance of such hook function is by using the accessor in the seq_file itself. But in a future scenario where the same file may be shared by multiple cftypes, this accessor will point only to the first of the cftypes linked to the seq_file. It will then be impossible to access the cftype owning the seq_show function within the seq_show itself, unless such cftype is the first one. This commit adds an additional seq_show_cft hook that has as a formal parameter also the cftype that owns the function. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- include/linux/cgroup-defs.h | 3 ++- kernel/cgroup/cgroup.c | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) -- 2.16.1 diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index 5e1694fe035b..7841db6e7fb3 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -543,8 +543,9 @@ struct cftype { */ s64 (*read_s64)(struct cgroup_subsys_state *css, struct cftype *cft); - /* generic seq_file read interface */ + /* generic seq_file read interfaces*/ int (*seq_show)(struct seq_file *sf, void *v); + int (*seq_show_cft)(struct seq_file *sf, struct cftype *cft, void *v); /* optional ops, implement all or none */ void *(*seq_start)(struct seq_file *sf, loff_t *ppos); diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 6aaf5dd5383b..9d0993dd68fe 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -1418,7 +1418,8 @@ static umode_t cgroup_file_mode(const struct cftype *cft) { umode_t mode = 0; - if (cft->read_u64 || cft->read_s64 || cft->seq_show) + if (cft->read_u64 || cft->read_s64 || cft->seq_show || + cft->seq_show_cft) mode |= S_IRUGO; if (cft->write_u64 || cft->write_s64 || cft->write) { @@ -3519,17 +3520,19 @@ static int cgroup_seqfile_show(struct seq_file *m, void *arg) { struct cftype *cft = seq_cft(m); struct cgroup_subsys_state *css = seq_css(m); + int ret = 0; if (cft->seq_show) - return cft->seq_show(m, arg); - - if (cft->read_u64) + ret = cft->seq_show(m, arg); + else if (cft->seq_show_cft) + ret = cft->seq_show_cft(m, cft, arg); + else if (cft->read_u64) seq_printf(m, "%llu\n", cft->read_u64(css, cft)); else if (cft->read_s64) seq_printf(m, "%lld\n", cft->read_s64(css, cft)); else - return -EINVAL; - return 0; + ret = -EINVAL; + return ret; } static struct kernfs_ops cgroup_kf_single_ops = { From patchwork Mon Nov 19 10:34:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 151469 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2489842ljp; Mon, 19 Nov 2018 02:34:46 -0800 (PST) X-Google-Smtp-Source: AJdET5egOaPUSdNPTZ7eaC8CQL12zcBTVHlGR4FXAegnWb26a12fmyh4HhEjRUbc0L1zswlnoZh4 X-Received: by 2002:a17:902:108a:: with SMTP id c10-v6mr21330028pla.171.1542623686617; Mon, 19 Nov 2018 02:34:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542623686; cv=none; d=google.com; s=arc-20160816; b=y4kNr/9nlpJVsDUPDuQRNHeRowmz+y1PTPii83lbgZzuABaqcCCj147tDcKdqsT4Ur 6m6qBsw7YSSfCi8FJwSlTS+JfHfT0YUEarutKLAhNt7VwG7Ed82h3jlGPkRWOaRIBnd5 SmqEy7xoVUPlCRxV+9DzPfwJTy6uGmkT2ffIfWWCsXS7KHmcKHx/3J514Pp9lPyOGtso 7FVOCjFXx2kdslOtXmLgB8RnvlaN8l1WY7RC694toz0BfgXr5KU7NuGi73SX0P7gYkih f1W73l2IsaK0HYHFlf4H0omAiplGf9WvBUZarb2KMhILAJ0erIau6soyIgjNStJW9zj9 cKGg== 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; bh=xE31UGISHMijh6BWsEpclRZoNNImo7FAKtEIn5NIV0A=; b=fa1yLsSijRsNjtl2jik51SRtc4VZg+kdwYr3U4/jeXM9iogziuwnVo9IaVkIa4P+f/ mLlY7ZARXmgUhh+B0W530mmHlCpeFwUWELnrhe04i2B7+mYy7wopL+p9Fb0R6EStbGba MobAg6DN8/4y9GrYtD24hm1NpfJqtJqx5m5aVhCQ8JtrmJoGOJ+VV37OkzFAp4+zETG1 jDud3oobZucKJyZyKr2U3Vsd2v20CTxWNDpnPleWX5vPteXuk51BdX06mM0fHcz9x4ls iydbLYhPPxlvC6POCl8WypSuW5h1vYQnOsmzSON2lhfVT16dLPU0tmdEh1NKfWrFvdsN NdrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SU4gX9Ur; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si42270968plj.53.2018.11.19.02.34.46; Mon, 19 Nov 2018 02:34:46 -0800 (PST) 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=@linaro.org header.s=google header.b=SU4gX9Ur; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728152AbeKSU54 (ORCPT + 32 others); Mon, 19 Nov 2018 15:57:56 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55650 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728117AbeKSU5z (ORCPT ); Mon, 19 Nov 2018 15:57:55 -0500 Received: by mail-wm1-f65.google.com with SMTP id y139so4734858wmc.5 for ; Mon, 19 Nov 2018 02:34:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xE31UGISHMijh6BWsEpclRZoNNImo7FAKtEIn5NIV0A=; b=SU4gX9UrHxz7m4v1tXtIXnFVKBC85SmHhU3WWiQYYH5YJWdQrx77/09MmnpPILr2Gv PCbKmtQgB2koGowWyZFjNRJlKJFv9udeNRVF/Tx2HHxFCDZQhXGe45I/uov9rCuAnB50 t7iYiiNqnQaObo/r0EtTj0WBdzrK0QxzCGtFc= 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=xE31UGISHMijh6BWsEpclRZoNNImo7FAKtEIn5NIV0A=; b=tsqfY9/xzb0lO/tGjl3PpcYNAzFL25nCPeaPhKJoTIgmABYsv1rinp7VfW+iE9cfR0 L6Nlo9l7VnEhPCz0N3Xhasx4Lq8lTitgrSfp4abcDLyJ6xTvR9zok2MMYPYTbrBjK27D /+rjr4YWocxu/uk8HVEcCaB78mCjAFWftraJMAgYcz37hTMuQVEjmTRtjZT4JzoaL4Oj 8/YfbI2qfXyjO/bQiWnag1c2uzRTJqEohSk1m6/bwNLbZwFueGi+slXzmyijjDAai8OS 2AoxknMzfWY4xY+RgRogjPBnM/VSI/o0echi9IE3zyQnlDXqRODIyTjG2k7l6VfbUPJy kPcg== X-Gm-Message-State: AA+aEWZhed7/StgoSJmG7O+2fqJVZXqm7Isca/dheISZmmxtr1z0HwWz yTPkJdO31hy34MSIOoBkWJeYgg== X-Received: by 2002:a1c:ce0e:: with SMTP id e14mr4785626wmg.53.1542623680540; Mon, 19 Nov 2018 02:34:40 -0800 (PST) Received: from localhost.localdomain ([37.162.18.180]) by smtp.gmail.com with ESMTPSA id e9sm14973298wro.16.2018.11.19.02.34.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:34:40 -0800 (PST) From: Paolo Valente To: Jens Axboe , Greg Kroah-Hartman , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Paolo Valente Subject: [PATCH V2 02/10] block, cgroup: pass cftype to functions that need to use it Date: Mon, 19 Nov 2018 11:34:16 +0100 Message-Id: <20181119103424.3853-3-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181119103424.3853-1-paolo.valente@linaro.org> References: <20181119103424.3853-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some seq_show functions need to access the cftype they belong to, for retrieving the data to show. These functions get their cftype by using the seq_cft accessor for the seq_file. This solution is no longer viable in case a seq_file is shared among more than one cftype, because the accessor always returns (only) the first of the cftypes sharing the seq_file. This commit enables these seq_show functions to be passed their cftype, by replacing their prototype with that of the newly defined seq_show_cft hook, and by invoking these functions through this new hook. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- block/bfq-cgroup.c | 54 ++++++++++++++++++++++++---------------------- block/blk-cgroup.c | 22 ++++++++++++------- block/blk-throttle.c | 8 +++---- include/linux/blk-cgroup.h | 10 +++++---- 4 files changed, 52 insertions(+), 42 deletions(-) -- 2.16.1 diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index a7a1712632b0..038e418fa64f 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -918,17 +918,17 @@ static ssize_t bfq_io_set_weight(struct kernfs_open_file *of, } #ifdef CONFIG_DEBUG_BLK_CGROUP -static int bfqg_print_stat(struct seq_file *sf, void *v) +static int bfqg_print_stat(struct seq_file *sf, struct cftype *cft, void *v) { blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), blkg_prfill_stat, - &blkcg_policy_bfq, seq_cft(sf)->private, false); + &blkcg_policy_bfq, cft->private, false); return 0; } -static int bfqg_print_rwstat(struct seq_file *sf, void *v) +static int bfqg_print_rwstat(struct seq_file *sf, struct cftype *cft, void *v) { blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), blkg_prfill_rwstat, - &blkcg_policy_bfq, seq_cft(sf)->private, true); + &blkcg_policy_bfq, cft->private, true); return 0; } @@ -949,19 +949,21 @@ static u64 bfqg_prfill_rwstat_recursive(struct seq_file *sf, return __blkg_prfill_rwstat(sf, pd, &sum); } -static int bfqg_print_stat_recursive(struct seq_file *sf, void *v) +static int bfqg_print_stat_recursive(struct seq_file *sf, struct cftype *cft, + void *v) { blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), bfqg_prfill_stat_recursive, &blkcg_policy_bfq, - seq_cft(sf)->private, false); + cft->private, false); return 0; } -static int bfqg_print_rwstat_recursive(struct seq_file *sf, void *v) +static int bfqg_print_rwstat_recursive(struct seq_file *sf, struct cftype *cft, + void *v) { blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), bfqg_prfill_rwstat_recursive, &blkcg_policy_bfq, - seq_cft(sf)->private, true); + cft->private, true); return 0; } @@ -1063,18 +1065,18 @@ struct cftype bfq_blkcg_legacy_files[] = { { .name = "bfq.io_service_bytes", .private = (unsigned long)&blkcg_policy_bfq, - .seq_show = blkg_print_stat_bytes, + .seq_show_cft = blkg_print_stat_bytes, }, { .name = "bfq.io_serviced", .private = (unsigned long)&blkcg_policy_bfq, - .seq_show = blkg_print_stat_ios, + .seq_show_cft = blkg_print_stat_ios, }, #ifdef CONFIG_DEBUG_BLK_CGROUP { .name = "bfq.time", .private = offsetof(struct bfq_group, stats.time), - .seq_show = bfqg_print_stat, + .seq_show_cft = bfqg_print_stat, }, { .name = "bfq.sectors", @@ -1083,22 +1085,22 @@ struct cftype bfq_blkcg_legacy_files[] = { { .name = "bfq.io_service_time", .private = offsetof(struct bfq_group, stats.service_time), - .seq_show = bfqg_print_rwstat, + .seq_show_cft = bfqg_print_rwstat, }, { .name = "bfq.io_wait_time", .private = offsetof(struct bfq_group, stats.wait_time), - .seq_show = bfqg_print_rwstat, + .seq_show_cft = bfqg_print_rwstat, }, { .name = "bfq.io_merged", .private = offsetof(struct bfq_group, stats.merged), - .seq_show = bfqg_print_rwstat, + .seq_show_cft = bfqg_print_rwstat, }, { .name = "bfq.io_queued", .private = offsetof(struct bfq_group, stats.queued), - .seq_show = bfqg_print_rwstat, + .seq_show_cft = bfqg_print_rwstat, }, #endif /* CONFIG_DEBUG_BLK_CGROUP */ @@ -1106,18 +1108,18 @@ struct cftype bfq_blkcg_legacy_files[] = { { .name = "bfq.io_service_bytes_recursive", .private = (unsigned long)&blkcg_policy_bfq, - .seq_show = blkg_print_stat_bytes_recursive, + .seq_show_cft = blkg_print_stat_bytes_recursive, }, { .name = "bfq.io_serviced_recursive", .private = (unsigned long)&blkcg_policy_bfq, - .seq_show = blkg_print_stat_ios_recursive, + .seq_show_cft = blkg_print_stat_ios_recursive, }, #ifdef CONFIG_DEBUG_BLK_CGROUP { .name = "bfq.time_recursive", .private = offsetof(struct bfq_group, stats.time), - .seq_show = bfqg_print_stat_recursive, + .seq_show_cft = bfqg_print_stat_recursive, }, { .name = "bfq.sectors_recursive", @@ -1126,22 +1128,22 @@ struct cftype bfq_blkcg_legacy_files[] = { { .name = "bfq.io_service_time_recursive", .private = offsetof(struct bfq_group, stats.service_time), - .seq_show = bfqg_print_rwstat_recursive, + .seq_show_cft = bfqg_print_rwstat_recursive, }, { .name = "bfq.io_wait_time_recursive", .private = offsetof(struct bfq_group, stats.wait_time), - .seq_show = bfqg_print_rwstat_recursive, + .seq_show_cft = bfqg_print_rwstat_recursive, }, { .name = "bfq.io_merged_recursive", .private = offsetof(struct bfq_group, stats.merged), - .seq_show = bfqg_print_rwstat_recursive, + .seq_show_cft = bfqg_print_rwstat_recursive, }, { .name = "bfq.io_queued_recursive", .private = offsetof(struct bfq_group, stats.queued), - .seq_show = bfqg_print_rwstat_recursive, + .seq_show_cft = bfqg_print_rwstat_recursive, }, { .name = "bfq.avg_queue_size", @@ -1150,22 +1152,22 @@ struct cftype bfq_blkcg_legacy_files[] = { { .name = "bfq.group_wait_time", .private = offsetof(struct bfq_group, stats.group_wait_time), - .seq_show = bfqg_print_stat, + .seq_show_cft = bfqg_print_stat, }, { .name = "bfq.idle_time", .private = offsetof(struct bfq_group, stats.idle_time), - .seq_show = bfqg_print_stat, + .seq_show_cft = bfqg_print_stat, }, { .name = "bfq.empty_time", .private = offsetof(struct bfq_group, stats.empty_time), - .seq_show = bfqg_print_stat, + .seq_show_cft = bfqg_print_stat, }, { .name = "bfq.dequeue", .private = offsetof(struct bfq_group, stats.dequeue), - .seq_show = bfqg_print_stat, + .seq_show_cft = bfqg_print_stat, }, #endif /* CONFIG_DEBUG_BLK_CGROUP */ { } /* terminate */ diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 63d226a084cd..772d32bbecae 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -565,15 +565,16 @@ static u64 blkg_prfill_rwstat_field(struct seq_file *sf, /** * blkg_print_stat_bytes - seq_show callback for blkg->stat_bytes * @sf: seq_file to print to + * @cft: cftype holding the data * @v: unused * * To be used as cftype->seq_show to print blkg->stat_bytes. * cftype->private must be set to the blkcg_policy. */ -int blkg_print_stat_bytes(struct seq_file *sf, void *v) +int blkg_print_stat_bytes(struct seq_file *sf, struct cftype *cft, void *v) { blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), - blkg_prfill_rwstat_field, (void *)seq_cft(sf)->private, + blkg_prfill_rwstat_field, (void *)cft->private, offsetof(struct blkcg_gq, stat_bytes), true); return 0; } @@ -582,15 +583,16 @@ EXPORT_SYMBOL_GPL(blkg_print_stat_bytes); /** * blkg_print_stat_bytes - seq_show callback for blkg->stat_ios * @sf: seq_file to print to + * @cft: cftype holding the data * @v: unused * * To be used as cftype->seq_show to print blkg->stat_ios. cftype->private * must be set to the blkcg_policy. */ -int blkg_print_stat_ios(struct seq_file *sf, void *v) +int blkg_print_stat_ios(struct seq_file *sf, struct cftype *cft, void *v) { blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), - blkg_prfill_rwstat_field, (void *)seq_cft(sf)->private, + blkg_prfill_rwstat_field, (void *)cft->private, offsetof(struct blkcg_gq, stat_ios), true); return 0; } @@ -608,13 +610,15 @@ static u64 blkg_prfill_rwstat_field_recursive(struct seq_file *sf, /** * blkg_print_stat_bytes_recursive - recursive version of blkg_print_stat_bytes * @sf: seq_file to print to + * @cft: cftype holding the data * @v: unused */ -int blkg_print_stat_bytes_recursive(struct seq_file *sf, void *v) +int blkg_print_stat_bytes_recursive(struct seq_file *sf, struct cftype *cft, + void *v) { blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), blkg_prfill_rwstat_field_recursive, - (void *)seq_cft(sf)->private, + (void *)cft->private, offsetof(struct blkcg_gq, stat_bytes), true); return 0; } @@ -623,13 +627,15 @@ EXPORT_SYMBOL_GPL(blkg_print_stat_bytes_recursive); /** * blkg_print_stat_ios_recursive - recursive version of blkg_print_stat_ios * @sf: seq_file to print to + * @cft: cftype holding the data * @v: unused */ -int blkg_print_stat_ios_recursive(struct seq_file *sf, void *v) +int blkg_print_stat_ios_recursive(struct seq_file *sf, struct cftype *cft, + void *v) { blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), blkg_prfill_rwstat_field_recursive, - (void *)seq_cft(sf)->private, + (void *)cft->private, offsetof(struct blkcg_gq, stat_ios), true); return 0; } diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 8f0a104770ee..6bfdaac53b6f 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -1493,22 +1493,22 @@ static struct cftype throtl_legacy_files[] = { { .name = "throttle.io_service_bytes", .private = (unsigned long)&blkcg_policy_throtl, - .seq_show = blkg_print_stat_bytes, + .seq_show_cft = blkg_print_stat_bytes, }, { .name = "throttle.io_service_bytes_recursive", .private = (unsigned long)&blkcg_policy_throtl, - .seq_show = blkg_print_stat_bytes_recursive, + .seq_show_cft = blkg_print_stat_bytes_recursive, }, { .name = "throttle.io_serviced", .private = (unsigned long)&blkcg_policy_throtl, - .seq_show = blkg_print_stat_ios, + .seq_show_cft = blkg_print_stat_ios, }, { .name = "throttle.io_serviced_recursive", .private = (unsigned long)&blkcg_policy_throtl, - .seq_show = blkg_print_stat_ios_recursive, + .seq_show_cft = blkg_print_stat_ios_recursive, }, { } /* terminate */ }; diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index a9e2e2037129..770b59e0d35f 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -207,10 +207,12 @@ u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, u64 blkg_prfill_stat(struct seq_file *sf, struct blkg_policy_data *pd, int off); u64 blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, int off); -int blkg_print_stat_bytes(struct seq_file *sf, void *v); -int blkg_print_stat_ios(struct seq_file *sf, void *v); -int blkg_print_stat_bytes_recursive(struct seq_file *sf, void *v); -int blkg_print_stat_ios_recursive(struct seq_file *sf, void *v); +int blkg_print_stat_bytes(struct seq_file *sf, struct cftype *cft, void *v); +int blkg_print_stat_ios(struct seq_file *sf, struct cftype *cft, void *v); +int blkg_print_stat_bytes_recursive(struct seq_file *sf, struct cftype *cft, + void *v); +int blkg_print_stat_ios_recursive(struct seq_file *sf, struct cftype *cft, + void *v); u64 blkg_stat_recursive_sum(struct blkcg_gq *blkg, struct blkcg_policy *pol, int off); From patchwork Mon Nov 19 10:34:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 151470 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2489881ljp; Mon, 19 Nov 2018 02:34:49 -0800 (PST) X-Google-Smtp-Source: AJdET5c6RdsMIkJo2GZieLTAEqehsolXlo59mVbMUUIf64SvKRZFXZ10kAxRhwjuNvjKMAjbIVue X-Received: by 2002:a17:902:6b03:: with SMTP id o3-v6mr21742349plk.208.1542623689419; Mon, 19 Nov 2018 02:34:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542623689; cv=none; d=google.com; s=arc-20160816; b=bxA46wwLoi90r6c1kh9c+AkATOS9C3/TXxkauTVop6sGwfPU/nfFcdw7AAtA2lgXik sHtXU2QUsOrX1xb6dboE4UEWhbWeFD9DDGgbTTopPFUJNlBDJfCU3jkSKpHCokdhj9tk fKISWIVO73JFUw0LJydMrShSHKAUknU7Ya9lY9UTbGXVLUJlq4XqvIPEdUgHqVbQXCXe E3//sIAQuYcA2cQ7ZTWhvgodD17ZLwFkbtuK40WQlo0rMHMRgmuPV6EzLHm6CXrNBXf/ 4PbTj0E03CI11Qj9A1ptuLhfrnLJDFdU3zoBuXrBWXZ5umf/25HTp9719d2aGNaTtLoU tlPw== 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; bh=x0Itf0ZxI+Oxy7a9zO1EZJNmqUfunAWUlaUx3OwJfXE=; b=hlyfO4wXOvGOi3AEXxZVnI1+WqrfH/VWLaUr1mUGr7DigZwO3UuU2VW2SXUnS/rv/Z cGpqKDt81SMnNVRpg/bl7qcPZL5yNblKd3/HSB+6xgRV6B5bPsFIlj6E9HaIpl36zb7o 8Eq331nrSdTUFFHLSEZ+BGsVOrVGRLqIRt5s2NhMowILT5wBlo+PUSfCGJEIbn9GRLWR H6EHLSb4az4l+QKJyT4THlsGg5jqU2+r9QUGzqX3bJNK5hyxv2fJfOJ6IfcGDwsQ6nJx YaSigLlAdB34oNcaoypElUIwWfWmwZ+XwHQ6Buo2M4bldDVi5/s2Kzz+L6YXPoc169Ns OJRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZY9L6xbr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v19si15214637pfa.80.2018.11.19.02.34.48; Mon, 19 Nov 2018 02:34:49 -0800 (PST) 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=@linaro.org header.s=google header.b=ZY9L6xbr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728194AbeKSU57 (ORCPT + 32 others); Mon, 19 Nov 2018 15:57:59 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:35345 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727760AbeKSU56 (ORCPT ); Mon, 19 Nov 2018 15:57:58 -0500 Received: by mail-wr1-f67.google.com with SMTP id 96so14542193wrb.2 for ; Mon, 19 Nov 2018 02:34:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=x0Itf0ZxI+Oxy7a9zO1EZJNmqUfunAWUlaUx3OwJfXE=; b=ZY9L6xbrDMh2HjcNz0YOjsrYk0Kmtklvb60AEmHSjiJI/Pk+YMBYPF0O31vnW8uYNA c9mhYofxWkWb+nOOBKPvdgFBpZSiuq0Z0Cb090oHVsvuIymAZOAd3UGEwStIpuBuMv3h 6BZEXTJWgLYIrrgwNuGx/H/HnMh1Ym7GLwhns= 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=x0Itf0ZxI+Oxy7a9zO1EZJNmqUfunAWUlaUx3OwJfXE=; b=Bm6i9cq9ix631Q3SeVjI8lp4Vomr/fEuuAGkJcQqCjV312HaG1HR/rtSk0h8B+7vuo 3KbpoH7Z3zg3T/gza0w5TSUpaqpZT2azs1nI/j4IVY0SsnV2VFDU052AdcKBX8K2hRZm QlUtpZQeK55ILDDazfuUwSWPR+crrY9PBA4FtvYzwn4YJoJrpifBCbPgTFRYrsbaKFvR 1B3LPkwiNDgPuBz2G0B7NTMfYS50Q0FzSCa3G/by2TF6YcaNj30imQkmKdo4YdDTjpN1 OXHZKOWEcbqDg2gmQuUZRCL8SJ9Ptd4dBVgI9TEOrJTVZRVbzKqdn6DDyUyloYygbYMt Z87A== X-Gm-Message-State: AGRZ1gLHDBSk404l7OIEW0d3YmTuLridTb4fYypBjNiNll5LzIOrvyv+ +9Dp+lL1BZ4bv1Ffpjsh7GQgOg== X-Received: by 2002:a5d:4acb:: with SMTP id y11mr17334824wrs.281.1542623683215; Mon, 19 Nov 2018 02:34:43 -0800 (PST) Received: from localhost.localdomain ([37.162.18.180]) by smtp.gmail.com with ESMTPSA id e9sm14973298wro.16.2018.11.19.02.34.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:34:42 -0800 (PST) From: Paolo Valente To: Jens Axboe , Greg Kroah-Hartman , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Paolo Valente Subject: [PATCH V2 03/10] cgroup: link cftypes of the same subsystem with the same name Date: Mon, 19 Nov 2018 11:34:17 +0100 Message-Id: <20181119103424.3853-4-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181119103424.3853-1-paolo.valente@linaro.org> References: <20181119103424.3853-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Angelo Ruocco Two entities, of any kind, are not able to create a cgroup file with the same name in the same folder: if an entity tries to create a file that has the same name as a file created by another entity, the cgroup core stops it, warns the user about the error, and then proceeds to delete all the files created by the last entity. However, in some specific situations, it may be useful for two or more entities to use a common file, e.g., the I/O schedulers bfq and cfq had the same "weight" attribute, that changed the behavior of the two schedulers in a similar way. This commit prepares the interface that allows two entities to share files. It adds a flag CFTYPE_SHARE_FILE for cftypes, flag that allows cftypes to be linked together if they are part of the same subsystem and have the same name. There is a limitation for a cftype that wants to share a file: it can't have the hooks seq_start/next/stop. The reason is that there is no consistent way to show portions of a file once multiple cftypes are attached to it, and thus more than one seq_show() is invoked: there are neither an univocal start point, nor univocal "next" and "stop" operations. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- include/linux/cgroup-defs.h | 9 ++++++ kernel/cgroup/cgroup.c | 78 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 85 insertions(+), 2 deletions(-) -- 2.16.1 diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index 7841db6e7fb3..d659763c7221 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -93,6 +93,8 @@ enum { CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ CFTYPE_WORLD_WRITABLE = (1 << 4), /* (DON'T USE FOR NEW FILES) S_IWUGO */ + CFTYPE_SHARES_FILE = (1 << 5), /* shares file w/ other cfts */ + /* internal flags, do not use outside cgroup core proper */ __CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */ __CFTYPE_NOT_ON_DFL = (1 << 17), /* not on default hierarchy */ @@ -528,6 +530,13 @@ struct cftype { */ struct cgroup_subsys *ss; /* NULL for cgroup core files */ struct list_head node; /* anchored at ss->cfts */ + + /* + * List of cftypes that are sharing the same file. It allows the hook + * functions of the cftypes in the list to be called together. + */ + struct list_head share_node; + struct kernfs_ops *kf_ops; int (*open)(struct kernfs_open_file *of); diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 9d0993dd68fe..61eafd69e2fd 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -1549,11 +1549,15 @@ struct cgroup *cgroup_kn_lock_live(struct kernfs_node *kn, bool drain_offline) return NULL; } -static void cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) +static void cgroup_rm_file(struct cgroup *cgrp, struct cftype *cft) { char name[CGROUP_FILE_NAME_MAX]; + struct kernfs_node *kn = kernfs_find_and_get(cgrp->kn, + cgroup_file_name(cgrp, cft, name)); + struct cftype *cfts = kn->priv; lockdep_assert_held(&cgroup_mutex); + kernfs_put(kn); if (cft->file_offset) { struct cgroup_subsys_state *css = cgroup_css(cgrp, cft->ss); @@ -1566,7 +1570,19 @@ static void cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) del_timer_sync(&cfile->notify_timer); } - kernfs_remove_by_name(cgrp->kn, cgroup_file_name(cgrp, cft, name)); + /* Delete the file only if it's used by one cftype */ + if (list_empty(&cft->share_node) || atomic_read(&kn->count) == 1) { + kernfs_remove(kn); + } else { + /* + * Update the "priv" pointer of the kernfs_node if the cftype + * that first created the file is removed. + */ + if (cft == cfts) + kn->priv = list_next_entry(cft, share_node); + + kernfs_put(kn); + } } /** @@ -3437,6 +3453,7 @@ static int cgroup_file_open(struct kernfs_open_file *of) { struct cftype *cft = of->kn->priv; + if (cft->open) return cft->open(of); return 0; @@ -3585,6 +3602,22 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp, #ifdef CONFIG_DEBUG_LOCK_ALLOC key = &cft->lockdep_key; #endif + + if (cft->flags & CFTYPE_SHARES_FILE) { + /* kn->count keeps track of how many cftypes share kn */ + kn = kernfs_find_and_get(cgrp->kn, + cgroup_file_name(cgrp, cft, name)); + if (kn) { + struct cftype *cfts = kn->priv; + + if (cfts->flags & CFTYPE_SHARES_FILE) + goto out_set_cfile; + else + kernfs_put(kn); + + } + } + kn = __kernfs_create_file(cgrp->kn, cgroup_file_name(cgrp, cft, name), cgroup_file_mode(cft), GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, @@ -3599,6 +3632,7 @@ static int cgroup_add_file(struct cgroup_subsys_state *css, struct cgroup *cgrp, return ret; } +out_set_cfile: if (cft->file_offset) { struct cgroup_file *cfile = (void *)css + cft->file_offset; @@ -3696,11 +3730,46 @@ static void cgroup_exit_cftypes(struct cftype *cfts) cft->kf_ops = NULL; cft->ss = NULL; + list_del(&cft->share_node); + /* revert flags set by cgroup core while adding @cfts */ cft->flags &= ~(__CFTYPE_ONLY_ON_DFL | __CFTYPE_NOT_ON_DFL); } } +/* + * Link a cftype that wants to share a file to the list of cftypes that are + * using it. + * + * The conditions for a cftype to be put in an existing list of cftypes and + * thus start to share a file are: + * - to have the flag CFTYPE_SHARES_FILE set; + * - to have all flags coincide with the flags of the other cftypes in the + * list; + * - to not have a seq_start hook: there is no consistent way to show + * portions of a file once multiple cftypes are attached to it, and thus + * more than one seq_show() is invoked. + * + * Once two or more cftypes are linked together, the file only points + * to the first of them. + */ +static void cgroup_link_cftype(struct cgroup_subsys *ss, struct cftype *cft) +{ + struct cftype *cfts; + + list_for_each_entry(cfts, &ss->cfts, node) { + struct cftype *c; + + for (c = cfts; c->name[0] != '\0'; c++) + if (c != cft && !(c->flags ^ cft->flags) && + !(c->seq_start || cft->seq_start) && + !strcmp(c->name, cft->name)) { + list_add(&cft->share_node, &c->share_node); + return; + } + } +} + static int cgroup_init_cftypes(struct cgroup_subsys *ss, struct cftype *cfts) { struct cftype *cft; @@ -3730,6 +3799,11 @@ static int cgroup_init_cftypes(struct cgroup_subsys *ss, struct cftype *cfts) cft->kf_ops = kf_ops; cft->ss = ss; + + INIT_LIST_HEAD(&cft->share_node); + + if (cft->flags & CFTYPE_SHARES_FILE) + cgroup_link_cftype(ss, cft); } return 0; From patchwork Mon Nov 19 10:34:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 151471 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2489922ljp; Mon, 19 Nov 2018 02:34:52 -0800 (PST) X-Google-Smtp-Source: AJdET5eHPYn8NCkirLG5K1ikxoVS+WL0P8VatIUHaTowdmFtITm3qftizzWbxP6zJldcAHNOfgc6 X-Received: by 2002:a63:a91a:: with SMTP id u26mr19308579pge.349.1542623692215; Mon, 19 Nov 2018 02:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542623692; cv=none; d=google.com; s=arc-20160816; b=TpPvJHtF8C/e5u5KAaz9VWpqP7u890XPuWceXPvaYenKvBL7yABNcHUxIUOSupLcRE LtglOFWAokf6ph8oEq4uv0wr7cfCz0lSfVhHfIVuz/whspBTvEeQlfIcAN7IAF8AHqrE J04O3TfTEb1blA/YmgaZ/kyaTIRWAFngM3Nldx+2ibLxi6uOh5+FimbayFgpaTZO4IvY gKZcpBDSBztGuaSg73jkKLCJj9keXKYO7OzQTIClkI+0vTafp+AG+6OqdsnWaCzZNByO DOxJA+8l7k/uHeKRNYnsFCm1baeyKftJYpRg5w/rg03GIBzUYkPLHKOYhgaUi1EKNfSY I3Wg== 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; bh=ixCco3tkgOz6XOnATIyg3v7JG+fMVyFH/i6hN9+7LbE=; b=QOHWS3SlHULtnUxjA3Ji+6Cn3sXECMLC5cAZ9qAVT5u5LluobowFe7OmYIFO4XbpcV Fv7kaB+uHy0NypTumP4s+K9zEW563j6Y2KO0xn4Cwu+5ZkP56Wbemo5LzzxiazwRVJJU JOl5HzZbPBxn4RbUiqFpbJgPF1VCKz6lDRCOAshG5/K/v6WMNs7rUjezEqFVvyYxxtb7 keZ4AiASVUC/7Xmh/6nwLxdCOqOX45eRJqJ3Zl16e879w1nvqZ8SrKLoDtmuYu3tAf7E WnqyVF1tEXhlIdx5CjjW8F4lUtUuC1+VNu2/NzuP0/Zv2h1WNraEHYx3Eo8ovaubOP1I 3c3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kKp2I6yh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5-v6si36714014pgv.38.2018.11.19.02.34.51; Mon, 19 Nov 2018 02:34:52 -0800 (PST) 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=@linaro.org header.s=google header.b=kKp2I6yh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728236AbeKSU6C (ORCPT + 32 others); Mon, 19 Nov 2018 15:58:02 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39794 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728160AbeKSU6A (ORCPT ); Mon, 19 Nov 2018 15:58:00 -0500 Received: by mail-wm1-f65.google.com with SMTP id u13-v6so4681396wmc.4 for ; Mon, 19 Nov 2018 02:34:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ixCco3tkgOz6XOnATIyg3v7JG+fMVyFH/i6hN9+7LbE=; b=kKp2I6yh/orVyEouSJpVWokRdAT9xO+g+kCnqgaaTzcRgXwvj2mzpvsQeI/fL870j/ FWJpkmfYHVEX994JHS9HKt3nipa3xeLHvXCMO6b7u5kQXIhAGjuRJ+Y8HyG2lb5f+Ag9 5/O6i7rXVsv45I3wffJr69woHSqCdtIyD3Cxw= 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=ixCco3tkgOz6XOnATIyg3v7JG+fMVyFH/i6hN9+7LbE=; b=Ljc7uZ5++6EFMOEUEnpIw+tx4A4HaE0d6hCm3FE89Ypqy/UilyoaHkHnXeQelekCJK jnarDJi/pTpGTe9e4Fuc97hBFKsQgrwcPbSISf7hOFDF0P/GuMpo1OCY76/yVyLWuX61 aB1EQrudsWi0EsjXVHGBGMO/XgvTFbJ69pF9qo/Qxb9XOFI7aB0CgWlDhQGYolCJB8ix TSFL5Sa69oITq8p9MaZMvY1SLkyKW4astoA9H4BEZzi4PbXrU15dPC+O7c87qXPCAWI2 FkUY8//BFnHMbyS5kSYi3h0dXD1RkqkO3Giwcg0zYnYeH2BIxYdkMIYtSvY+GEJOi98O yBkQ== X-Gm-Message-State: AA+aEWZ7gGrI1rxysm5JCeLCUZw9qZEdqRs8WZvBOvvOsqBZKB9LJdho UrF1fniN9ejoQJhgmlkAfyPagQ== X-Received: by 2002:a1c:2b45:: with SMTP id r66-v6mr6662149wmr.128.1542623686156; Mon, 19 Nov 2018 02:34:46 -0800 (PST) Received: from localhost.localdomain ([37.162.18.180]) by smtp.gmail.com with ESMTPSA id e9sm14973298wro.16.2018.11.19.02.34.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:34:45 -0800 (PST) From: Paolo Valente To: Jens Axboe , Greg Kroah-Hartman , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Paolo Valente Subject: [PATCH V2 04/10] cgroup: add owner name to cftypes Date: Mon, 19 Nov 2018 11:34:18 +0100 Message-Id: <20181119103424.3853-5-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181119103424.3853-1-paolo.valente@linaro.org> References: <20181119103424.3853-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Angelo Ruocco The piece of information "who created a certain cftype" is not stored anywhere, thus a cftype is not able to know who is its owner. This commit addresses this problem by adding a new field in the cftype structure that enables the name of its owner to be explicitly set. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- include/linux/cgroup-defs.h | 2 ++ include/linux/cgroup.h | 13 +++++++++++++ 2 files changed, 15 insertions(+) -- 2.16.1 diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index d659763c7221..6e31f478c6e1 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -36,6 +36,7 @@ struct seq_file; #define MAX_CGROUP_TYPE_NAMELEN 32 #define MAX_CGROUP_ROOT_NAMELEN 64 #define MAX_CFTYPE_NAME 64 +#define MAX_OWNER_NAME 64 /* define the enumeration of all cgroup subsystems */ #define SUBSYS(_x) _x ## _cgrp_id, @@ -505,6 +506,7 @@ struct cftype { * end of cftype array. */ char name[MAX_CFTYPE_NAME]; + char owner_name[MAX_OWNER_NAME]; unsigned long private; /* diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 9d12757a65b0..267153bd898a 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -291,6 +291,19 @@ void css_task_iter_end(struct css_task_iter *it); ; \ else +/** + * list_for_each_cft - walk circular list of cftypes linked together + * @cft: cftype from where to start + * @n: cftype used as a temporary storage + * + * A cftype pointed by a file may be part of a circular list of cftypes, this + * macro walks the circular list starting from any given cftype. Unlike the + * "list_for_each_entry" macro, the first element is included in the iteration. + */ +#define list_for_each_cft(cft, n) \ + for (n = NULL; cft != n; n = (n == NULL) ? cft : n, \ + cft = list_next_entry(cft, share_node)) + /* * Inline functions. */ From patchwork Mon Nov 19 10:34:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 151472 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2489966ljp; Mon, 19 Nov 2018 02:34:55 -0800 (PST) X-Google-Smtp-Source: AJdET5c0GAnGLdW/pINIzW4mGXG4ZwiWCyZAVmOyJKayqWOGXWIvHT1JCOSbKNzhqCjwyLii9iYn X-Received: by 2002:a63:cc12:: with SMTP id x18mr19435535pgf.33.1542623695322; Mon, 19 Nov 2018 02:34:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542623695; cv=none; d=google.com; s=arc-20160816; b=SSCI0bAg82DvrXdqqKtTpnGtEifYw1JbvDfmh8dTj2wBAhqIssLTO6j+eYrAOmghTJ Fsok7qH+7LiaWu2Rxe+zcwkFMb57Xwu6koGyOgAqdn/Ua0ebfn3H6ll+lQtFDqdCUKBu H302MnW70RirKqbdvT9Mc0TyduIBZFDB29yE5NyZz91GQEHz820gK1fXB1/07BqYL1/h LxWsN0e6AZc2iyt/0lDuDhIOyuhoy+JwbopDejifwjau7QH8uszNFl8KVpJh7EbgLAnP NE60VJFtVuv13xt78ZKmhjBZ168Qys8kwfELiHYN4PXiKkiTjgLF8WCvdJ62qcD7Y9Gc +Q5A== 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; bh=X5boqJ0UbdeKGVE+FnIPUcIjT6rvSPY3NTZlqHlp7eY=; b=LCKofZ+xyCD+pYETq1xUcpfIA4S7vMHElNNaMmqBQ+XNGhdU5ELYh3bwNHTj/rwu1g Wia1lMVGvAuN0ln7hQonpKcfoBmkC3I9oRNMJXzXh6uN+ksWUJuDsdyhtsIVN35OBcHW PfwgkMtn0HT/fzAUiCHZEYxlSGiX+kqMkiDbwWCdmFZoyz6PDTFBLx68uS3abQWyBBFX etYJDdPmzkOGtdIWqljnR8CLV+xvZ4CBJ/zkk+p1yckEQg0mbUyemktn07Z2xwn/Mh61 bh/ghjRXJC6AwM1jdOs2uRv1F+4RHrQN+0Dt2HOCqwyU9yaCgHpmxiLAEaCljSpnMdLB OETQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cOaOohdK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5-v6si36714014pgv.38.2018.11.19.02.34.54; Mon, 19 Nov 2018 02:34:55 -0800 (PST) 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=@linaro.org header.s=google header.b=cOaOohdK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728277AbeKSU6F (ORCPT + 32 others); Mon, 19 Nov 2018 15:58:05 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38379 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728238AbeKSU6D (ORCPT ); Mon, 19 Nov 2018 15:58:03 -0500 Received: by mail-wr1-f65.google.com with SMTP id e3-v6so31458227wrs.5 for ; Mon, 19 Nov 2018 02:34:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X5boqJ0UbdeKGVE+FnIPUcIjT6rvSPY3NTZlqHlp7eY=; b=cOaOohdKAX6mJq3wr2E6Hwafuweehz68ABx+2oXHJV0TZuvr4qoCBxK2dufKJTVwOI pIuCn8YJgCmgtwHWw/Bhfhh2VvhLRaaHj0AkzG5SpAmKlDJQv+8kIIsF2MoREcj+qMIQ C2MBBTrmNvoV9HHeYBNRnb8XIcdxNvnBM7qSs= 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=X5boqJ0UbdeKGVE+FnIPUcIjT6rvSPY3NTZlqHlp7eY=; b=JTGZo4DxFIr113Kz45+Cd2Aqlh/4tJtaxDvXp0FGZuVEXrdP1H6IstiiWhJHmf2urD SHdSdP2B0t+CP35sHOJX0vZ8B0W5UYuwxChqJ68ICylRVur/IqQD4tSl3Z+8O5vOAn72 Co4DzKE8qgbaYE9kv5y0i14eVX3WFD724v6VcOQ1Rqv3QbJLKBGDiFdncR9/o3xYfYCc pjSBA1qj/fy0xmIO76ONyWQZmVzz+wVRyMUHSN314j7+2lNFzsmot/KASb3BtFxGgwML i9h6N81i+ko31pAD1i8jq66fM5qXxQeRFfFVGVneB5fyYHdoXyEk9spmQG4krlMW6u8k GH1w== X-Gm-Message-State: AGRZ1gKC3fS9PoPeb5Hyxax31rHmBlLtpm+5jOUlVSWoDEf6rQeFTCsR OeNGZ2zpqrGO2RVntNRHfWB6nQ== X-Received: by 2002:a5d:6187:: with SMTP id j7mr17824022wru.300.1542623689487; Mon, 19 Nov 2018 02:34:49 -0800 (PST) Received: from localhost.localdomain ([37.162.18.180]) by smtp.gmail.com with ESMTPSA id e9sm14973298wro.16.2018.11.19.02.34.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:34:49 -0800 (PST) From: Paolo Valente To: Jens Axboe , Greg Kroah-Hartman , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Paolo Valente Subject: [PATCH V2 05/10] block, bfq: align min and default weights with the old cfq default Date: Mon, 19 Nov 2018 11:34:19 +0100 Message-Id: <20181119103424.3853-6-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181119103424.3853-1-paolo.valente@linaro.org> References: <20181119103424.3853-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Angelo Ruocco bfq exposes a cgroup attribute, weight, with the same meaning as that exposed by cfq. This commit changes bfq default and min weights to match the ones set by cfq (before legacy blk was removed). Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- block/bfq-iosched.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.16.1 diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index 77651d817ecd..249d8128d3ee 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h @@ -22,13 +22,13 @@ #define BFQ_IOPRIO_CLASSES 3 #define BFQ_CL_IDLE_TIMEOUT (HZ/5) -#define BFQ_MIN_WEIGHT 1 +#define BFQ_MIN_WEIGHT 10 #define BFQ_MAX_WEIGHT 1000 #define BFQ_WEIGHT_CONVERSION_COEFF 10 #define BFQ_DEFAULT_QUEUE_IOPRIO 4 -#define BFQ_WEIGHT_LEGACY_DFL 100 +#define BFQ_WEIGHT_LEGACY_DFL 500 #define BFQ_DEFAULT_GRP_IOPRIO 0 #define BFQ_DEFAULT_GRP_CLASS IOPRIO_CLASS_BE From patchwork Mon Nov 19 10:34:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 151473 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2490000ljp; Mon, 19 Nov 2018 02:34:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/XTq8a+f6IyvilZPamln+VNiDzN9lalsRhUGqVxZ0oSvvr8FS64aTuGnpVGpM5Y9YBWeyju X-Received: by 2002:a63:165e:: with SMTP id 30mr7369985pgw.103.1542623697368; Mon, 19 Nov 2018 02:34:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542623697; cv=none; d=google.com; s=arc-20160816; b=aDPS6ldj3UvBEHVxDPhC5gzCxYrU9/cm+tOKT5kER0xCShU9WI35Ti/PG//n0Kgsvb LnwtpioWTTDanQrxKUwxM2qh1zQjspHgDN9qNYl83JKzRdN7idcTD/uOpATvTHo40P6S RMFrdvhMlrWQe5/mhkJcxpEExdx1J2TZexgd/Whjkw00Q+iKe7rcfRJOA8pqPboH85Ef uEh0RTNSmFrRSfEdpDcDWHghwEW6WnDnN4ZomLdyaCuqx+r5cNIGS5M6c3jriQXgUWlR fFsoPipvfQGe5UvjdW/TLxvy3hk4BcRe64v/WB6eJ/bh0XEWH2cz3r9Cnw5PBl/O+gWa aptg== 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; bh=U4mx1fsW9hQVbmr4//R68r7KKVwetfXIYfE3uWdN0BA=; b=uxipOc6vSddaE3LTAYVv+oNO4P2kewgs1R0PQinz+EEGkmE65LxeBTopiEb+cC4W+z iizDwiC8RPR0Gc2w+1FVTR4IYD6TVTLcG0ShF/uNd0Q4DccgzzMYP2anhv8TADA/1p+d ENgsDUvLN85/FpB2hHtCdWZkITFUUlxeMABlpL+RwMLps3qu0mmgq+3+OY3yOfVYme2k eUjnmxA8WlsjZckxTHSYws++4H/cSFClFp4xYmBxQ5ohwiRvoZpb2Rd3lqkAL8ll5MVi EmYor8/imTUbpW54ENm1EPgdEDIExWomCPkyv68+NRCspj2xb0hrJSEzfgduFGN6O1jb rJug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wmfejyvw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si17049986pfd.86.2018.11.19.02.34.56; Mon, 19 Nov 2018 02:34:57 -0800 (PST) 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=@linaro.org header.s=google header.b=Wmfejyvw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728334AbeKSU6H (ORCPT + 32 others); Mon, 19 Nov 2018 15:58:07 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40989 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728285AbeKSU6G (ORCPT ); Mon, 19 Nov 2018 15:58:06 -0500 Received: by mail-wr1-f67.google.com with SMTP id x10so2778305wrs.8 for ; Mon, 19 Nov 2018 02:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U4mx1fsW9hQVbmr4//R68r7KKVwetfXIYfE3uWdN0BA=; b=WmfejyvwiqglaM7h5Ev4Z0FCeNcqTiYIIExPQ4Tm4odYSIRRi7BQKPz60lpr5NxKUn Ql1cG2nTKWLNdExnpTToG1ROtic9FG/wQtE4SiV+z7fwdjnpxuYSE5pHUn2+EKlQHGQg sT2nPkqTp2x2oDyuhu8iBxzs0ALZZ7E508z78= 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=U4mx1fsW9hQVbmr4//R68r7KKVwetfXIYfE3uWdN0BA=; b=P/k7X4JLJaZrrAST21q1nFIsmFop3IwqG9bkRhwYmCbjcaqNOTfti5AiXQiq3fb/yy nA5oyfBZ3ut3nX6AGkZB7QPqy94jgt2yu+j5vPAl3Gg+7a+Wimdwpru8Kptg9+PodEke er/hHmGHJ0lGfBRiF3MTDzu6rAXbi81JMlLu0rIMgYqagovq8al1XQ2FdcJO4k8+lHkU gB8+Dr0E60mvxPF07TCgLSZ04wrsFqO5B2wSgdl5IUjXm42OsPKBRxsRXxydpYay4QIP me/1v7kam8Tix3tDMfr0/hkxRWOswxghRCE77YGbD1iBhvgrFs4XAWH9WrHOJLwXXYhL F5nA== X-Gm-Message-State: AA+aEWZ+98as0eFmX5vWisjBOzMpsLba984BLS+POjXhMi6zrzWEhVvv brM8OFBY4WF53SiJrdslu/dmLA== X-Received: by 2002:a5d:410e:: with SMTP id l14mr9321492wrp.61.1542623692598; Mon, 19 Nov 2018 02:34:52 -0800 (PST) Received: from localhost.localdomain ([37.162.18.180]) by smtp.gmail.com with ESMTPSA id e9sm14973298wro.16.2018.11.19.02.34.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:34:52 -0800 (PST) From: Paolo Valente To: Jens Axboe , Greg Kroah-Hartman , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Paolo Valente Subject: [PATCH V2 06/10] cgroup: make all functions of all cftypes be invoked Date: Mon, 19 Nov 2018 11:34:20 +0100 Message-Id: <20181119103424.3853-7-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181119103424.3853-1-paolo.valente@linaro.org> References: <20181119103424.3853-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Angelo Ruocco When two or more entities (of any kind) share a file, their respective cftypes are linked together. The allowed operations on those files are: open, release, write and show, mapped to the functions defined in the cftypes. This commit makes the cgroup core invoke, whenever one of those operations is requested, the respective function of all the cftypes linked together. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- kernel/cgroup/cgroup.c | 181 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 132 insertions(+), 49 deletions(-) -- 2.16.1 diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 61eafd69e2fd..9bf6b0b5a0ca 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -3452,66 +3452,107 @@ static int cgroup_cpu_pressure_show(struct seq_file *seq, void *v) static int cgroup_file_open(struct kernfs_open_file *of) { struct cftype *cft = of->kn->priv; + struct cftype *n; + int ret = 0; + list_for_each_cft(cft, n) { + if (cft->open) + ret = cft->open(of); + /* + * If there has been an error with the open function of one of + * the cft associated with the file, we call the release + * function of all the cftype associated to cft whose open + * function succeded. + */ + if (ret) { + struct cftype *c = of->kn->priv; + struct cftype *n; + + list_for_each_cft(c, n) { + if (cft == c) + break; + if (c->release) + c->release(of); + } + break; + } + } - if (cft->open) - return cft->open(of); - return 0; + return ret; } static void cgroup_file_release(struct kernfs_open_file *of) { struct cftype *cft = of->kn->priv; + struct cftype *n; - if (cft->release) - cft->release(of); + list_for_each_cft(cft, n) + if (cft->release) + cft->release(of); } +/* + * Call all the write functions of the cftypes associated with the file. + * + * When a write fails, don't keep trying to write into the file via the write + * functions of the other cftypes associated with it. + */ static ssize_t cgroup_file_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off) { struct cgroup_namespace *ns = current->nsproxy->cgroup_ns; struct cgroup *cgrp = of->kn->parent->priv; struct cftype *cft = of->kn->priv; + struct cftype *n; struct cgroup_subsys_state *css; - int ret; + int ret = 0; - /* - * If namespaces are delegation boundaries, disallow writes to - * files in an non-init namespace root from inside the namespace - * except for the files explicitly marked delegatable - - * cgroup.procs and cgroup.subtree_control. - */ - if ((cgrp->root->flags & CGRP_ROOT_NS_DELEGATE) && - !(cft->flags & CFTYPE_NS_DELEGATABLE) && - ns != &init_cgroup_ns && ns->root_cset->dfl_cgrp == cgrp) - return -EPERM; + list_for_each_cft(cft, n) { + /* + * If namespaces are delegation boundaries, disallow writes to + * files in an non-init namespace root from inside the + * namespace except for the files explicitly marked + * delegatable - cgroup.procs and cgroup.subtree_control. + */ + if ((cgrp->root->flags & CGRP_ROOT_NS_DELEGATE) && + !(cft->flags & CFTYPE_NS_DELEGATABLE) && + ns != &init_cgroup_ns && ns->root_cset->dfl_cgrp == cgrp) + return -EPERM; - if (cft->write) - return cft->write(of, buf, nbytes, off); + if (cft->write) { + ret = cft->write(of, buf, nbytes, off); - /* - * kernfs guarantees that a file isn't deleted with operations in - * flight, which means that the matching css is and stays alive and - * doesn't need to be pinned. The RCU locking is not necessary - * either. It's just for the convenience of using cgroup_css(). - */ - rcu_read_lock(); - css = cgroup_css(cgrp, cft->ss); - rcu_read_unlock(); + if (ret) + break; + continue; + } - if (cft->write_u64) { - unsigned long long v; - ret = kstrtoull(buf, 0, &v); - if (!ret) - ret = cft->write_u64(css, cft, v); - } else if (cft->write_s64) { - long long v; - ret = kstrtoll(buf, 0, &v); - if (!ret) - ret = cft->write_s64(css, cft, v); - } else { - ret = -EINVAL; + /* + * kernfs guarantees that a file isn't deleted with operations + * in flight, which means that the matching css is and stays + * alive and doesn't need to be pinned. The RCU locking is not + * necessary either. It's just for the convenience of using + * cgroup_css(). + */ + rcu_read_lock(); + css = cgroup_css(cgrp, cft->ss); + rcu_read_unlock(); + + if (cft->write_u64) { + unsigned long long v; + + ret = kstrtoull(buf, 0, &v); + if (!ret) + ret = cft->write_u64(css, cft, v); + } else if (cft->write_s64) { + long long v; + + ret = kstrtoll(buf, 0, &v); + if (!ret) + ret = cft->write_s64(css, cft, v); + } else { + return -EINVAL; + } } return ret ?: nbytes; @@ -3533,22 +3574,64 @@ static void cgroup_seqfile_stop(struct seq_file *seq, void *v) seq_cft(seq)->seq_stop(seq, v); } +/* + * A file shared by more cftypes may be showing different values. In that case + * call all the show functions and print the name of the owner that defined + * them. + */ static int cgroup_seqfile_show(struct seq_file *m, void *arg) { struct cftype *cft = seq_cft(m); + struct cftype *n; struct cgroup_subsys_state *css = seq_css(m); + char *first_seqshow_str = NULL; + size_t first_str_size = 0; + size_t current_str_size = 0; int ret = 0; - if (cft->seq_show) - ret = cft->seq_show(m, arg); - else if (cft->seq_show_cft) - ret = cft->seq_show_cft(m, cft, arg); - else if (cft->read_u64) - seq_printf(m, "%llu\n", cft->read_u64(css, cft)); - else if (cft->read_s64) - seq_printf(m, "%lld\n", cft->read_s64(css, cft)); - else - ret = -EINVAL; + list_for_each_cft(cft, n) { + if (cft->seq_show) { + ret = cft->seq_show(m, arg); + if (ret) + break; + } else if (cft->seq_show_cft) { + ret = cft->seq_show_cft(m, cft, arg); + if (ret) + break; + } else if (cft->read_u64) { + seq_printf(m, "%llu\n", cft->read_u64(css, cft)); + } else if (cft->read_s64) { + seq_printf(m, "%lld\n", cft->read_s64(css, cft)); + } else { + ret = -EINVAL; + break; + } + current_str_size = m->count - current_str_size; + + if (first_seqshow_str == NULL) { + first_seqshow_str = kmalloc(m->size, GFP_KERNEL); + first_str_size = m->count; + strcpy(first_seqshow_str, m->buf); + first_str_size = m->count; + } else if (strcmp(first_seqshow_str, + m->buf + m->count - current_str_size)) { + first_str_size = -1; + } + + if (current_str_size) { + seq_printf(m, " - %s\n", cft->owner_name); + current_str_size = m->count; + } + } + + /* + * If all the cft->seqfile_show/read are equal, truncate the + * output of the seqfile to the length of the first string. + */ + if (first_str_size != -1) + m->count = first_str_size; + + kfree(first_seqshow_str); return ret; } From patchwork Mon Nov 19 10:34:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 151474 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2490038ljp; Mon, 19 Nov 2018 02:34:59 -0800 (PST) X-Google-Smtp-Source: AJdET5ehG+Evsjk3ObW3NC2Gbig5JI37HJrIqBP0XIfUJ7jBOa9Qo6iy7zpoWfM1WOyyEDwVqnZP X-Received: by 2002:a63:5b48:: with SMTP id l8mr19763400pgm.80.1542623699831; Mon, 19 Nov 2018 02:34:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542623699; cv=none; d=google.com; s=arc-20160816; b=D3iXe8gHjBIPi1IU55quURRYVtBtWMWSfLIE1pvfwx8XAgAlDLKjiZ1RR10ZlGuFNL 5OjV1YGcUBsZ1JXendkuX0c+BFkvBdWmJD5vQ4Mf0vKv+YdkoI+qtOHrocKOiOhv3bc3 IIV+VWMsVuETCGkWJ1s47C8W4Q7L5wRsljAhjhqckPqsBVL9n/1/r1u0q13XAS+Nn1k2 nh/K4T387v0GInML42BGfpH2is7cvOyrYhsl8b4H+QAew+smWgDRU9vyAeI3A/RxD8Xv 7kJcCG52stqlMZi0u5/N/nDrv5yhvWpVmEP8qMQTtFL7WpobdHqRVS/+G4EjNOl17sW3 Arvw== 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; bh=hWUit/vYiH26YHlA9buP+oQITDwnzmUPMPxq3d9LPkE=; b=L1BpECLRJ6yGN5ieY+R1SAtTdLX/fgh0EOTw9KxGLJMkrPTaiI/cl7Fec1+pCuBwpE SkJkhLy64Ix2yCZuCF9Jxl+eFhs5t2K3ZaAdc1cvIGehJd2xi2/NUKqsg6bLATCKQ+oo SA4nWFzgd5OAu6J99wEPbSIMr8uqBH60fSpGTUux3eCS8V0bLVp1HSLjWrlBdTCDF4wS khGYuMSepUn/C2a8TMQRFO7kRkLCNWU6ju54mOUQkNqqlDnnXAICbvWO2UwqfW0/Bg35 +F7ZXtEQ5ebbjlwjln19VxN6eh/pIuHe0jHepolanoZdqURGrw7nptWpTFFrWeC6u2mT fYRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YfU6dTeT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u16si10221698plk.192.2018.11.19.02.34.59; Mon, 19 Nov 2018 02:34:59 -0800 (PST) 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=@linaro.org header.s=google header.b=YfU6dTeT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728381AbeKSU6K (ORCPT + 32 others); Mon, 19 Nov 2018 15:58:10 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45276 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728285AbeKSU6J (ORCPT ); Mon, 19 Nov 2018 15:58:09 -0500 Received: by mail-wr1-f65.google.com with SMTP id v6so9566832wrr.12 for ; Mon, 19 Nov 2018 02:34:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hWUit/vYiH26YHlA9buP+oQITDwnzmUPMPxq3d9LPkE=; b=YfU6dTeTHM5A73Tg5BMA4Dw8e7o9lmuB/XXB5c23ILL9CwfpTx7baLDS9fcxsc4otQ h+tJUzNJjWWpTo+fcsVP95Nv2im3yghKNLInHuZODRvbKsDeb2XPU70gXHTWu30bsKH+ nOdzVt5hy9oioZwEv6JpXsY9wqtsNzerY764E= 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=hWUit/vYiH26YHlA9buP+oQITDwnzmUPMPxq3d9LPkE=; b=qk14YTjhFLNXNP87CUE0MbIYh6vm6wY2TmRsXMIzl/a/oVvJoErCpiJ2fmOyIzxoOY O7R7Sb38kdyKPp6AOHtYx3oEvaLk8ESpupfKqhV85Q6Tzuc0k122z33zsngtfAf2vyFE FPc5r38dwOWlDYjK0Vpccj7DwP9z2yl/lEWEfsLMTF8w6g94v2iQDQLnIS97CiuHwALy 80TC+oWbokFgdMNDFJUPxToIR0s/CCtacdDjDdlXYeT8RYIdkxiG0I+y6vSteITeR+8N YgMQ+UPGfRYjO3Eu+jJYXWs2L7AmCJPRQlwFWP/ihcCQJKRjficCk3etK8ERw6gG0ecP K5og== X-Gm-Message-State: AGRZ1gJ7szEqSCJfNtPwbvw1nF0L0WT2qXzA25OtQJwvGoJJ0ILIyYjS Krt8krH6qzi1b0HFBSeGVhIumw== X-Received: by 2002:adf:9387:: with SMTP id 7-v6mr17123195wrp.269.1542623695517; Mon, 19 Nov 2018 02:34:55 -0800 (PST) Received: from localhost.localdomain ([37.162.18.180]) by smtp.gmail.com with ESMTPSA id e9sm14973298wro.16.2018.11.19.02.34.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:34:55 -0800 (PST) From: Paolo Valente To: Jens Axboe , Greg Kroah-Hartman , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Paolo Valente Subject: [PATCH V2 07/10] block, bfq: use standard file names for the proportional-share policy Date: Mon, 19 Nov 2018 11:34:21 +0100 Message-Id: <20181119103424.3853-8-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181119103424.3853-1-paolo.valente@linaro.org> References: <20181119103424.3853-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some of the files exposed in a cgroup by bfq, for the proportional share policy, have the same meaning as the files owned by cfq (before legacy blk was removed). The old implementation of the cgroup interface didn't allow different entities to create cgroup files with the same name (in the same subsystem). So, for bfq, we had to add the prefix "bfq" to the names of its cgroup files. This commit renames the cgroup files of the bfq scheduler as those exposed by cfq, and makes bfq willing to share these files with any other future policy. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- block/bfq-cgroup.c | 94 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 69 insertions(+), 25 deletions(-) -- 2.16.1 diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index 038e418fa64f..0643147b2cbc 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -1055,50 +1055,67 @@ struct blkcg_policy blkcg_policy_bfq = { struct cftype bfq_blkcg_legacy_files[] = { { - .name = "bfq.weight", - .flags = CFTYPE_NOT_ON_ROOT, + .name = "weight", + .owner_name = "bfq", + .flags = CFTYPE_NOT_ON_ROOT | CFTYPE_SHARES_FILE, .seq_show = bfq_io_show_weight, .write_u64 = bfq_io_set_weight_legacy, }, /* statistics, covers only the tasks in the bfqg */ { - .name = "bfq.io_service_bytes", + .name = "io_service_bytes", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_bfq, .seq_show_cft = blkg_print_stat_bytes, }, { - .name = "bfq.io_serviced", + .name = "io_serviced", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_bfq, .seq_show_cft = blkg_print_stat_ios, }, #ifdef CONFIG_DEBUG_BLK_CGROUP { - .name = "bfq.time", + .name = "time", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.time), .seq_show_cft = bfqg_print_stat, }, { - .name = "bfq.sectors", + .name = "sectors", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .seq_show = bfqg_print_stat_sectors, }, { - .name = "bfq.io_service_time", + .name = "io_service_time", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.service_time), .seq_show_cft = bfqg_print_rwstat, }, { - .name = "bfq.io_wait_time", + .name = "io_wait_time", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.wait_time), .seq_show_cft = bfqg_print_rwstat, }, { - .name = "bfq.io_merged", + .name = "io_merged", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.merged), .seq_show_cft = bfqg_print_rwstat, }, { - .name = "bfq.io_queued", + .name = "io_queued", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.queued), .seq_show_cft = bfqg_print_rwstat, }, @@ -1106,66 +1123,92 @@ struct cftype bfq_blkcg_legacy_files[] = { /* the same statictics which cover the bfqg and its descendants */ { - .name = "bfq.io_service_bytes_recursive", + .name = "io_service_bytes_recursive", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_bfq, .seq_show_cft = blkg_print_stat_bytes_recursive, }, { - .name = "bfq.io_serviced_recursive", + .name = "io_serviced_recursive", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_bfq, .seq_show_cft = blkg_print_stat_ios_recursive, }, #ifdef CONFIG_DEBUG_BLK_CGROUP { - .name = "bfq.time_recursive", + .name = "time_recursive", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.time), .seq_show_cft = bfqg_print_stat_recursive, }, { - .name = "bfq.sectors_recursive", + .name = "sectors_recursive", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .seq_show = bfqg_print_stat_sectors_recursive, }, { - .name = "bfq.io_service_time_recursive", + .name = "io_service_time_recursive", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.service_time), .seq_show_cft = bfqg_print_rwstat_recursive, }, { - .name = "bfq.io_wait_time_recursive", + .name = "io_wait_time_recursive", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.wait_time), .seq_show_cft = bfqg_print_rwstat_recursive, }, { - .name = "bfq.io_merged_recursive", + .name = "io_merged_recursive", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.merged), .seq_show_cft = bfqg_print_rwstat_recursive, }, { - .name = "bfq.io_queued_recursive", + .name = "io_queued_recursive", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.queued), .seq_show_cft = bfqg_print_rwstat_recursive, }, { - .name = "bfq.avg_queue_size", + .name = "avg_queue_size", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .seq_show = bfqg_print_avg_queue_size, }, { - .name = "bfq.group_wait_time", + .name = "group_wait_time", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.group_wait_time), .seq_show_cft = bfqg_print_stat, }, { - .name = "bfq.idle_time", + .name = "idle_time", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.idle_time), .seq_show_cft = bfqg_print_stat, }, { - .name = "bfq.empty_time", + .name = "empty_time", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.empty_time), .seq_show_cft = bfqg_print_stat, }, { - .name = "bfq.dequeue", + .name = "dequeue", + .owner_name = "bfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct bfq_group, stats.dequeue), .seq_show_cft = bfqg_print_stat, }, @@ -1175,8 +1218,9 @@ struct cftype bfq_blkcg_legacy_files[] = { struct cftype bfq_blkg_files[] = { { - .name = "bfq.weight", - .flags = CFTYPE_NOT_ON_ROOT, + .name = "weight", + .owner_name = "bfq", + .flags = CFTYPE_NOT_ON_ROOT | CFTYPE_SHARES_FILE, .seq_show = bfq_io_show_weight, .write = bfq_io_set_weight, }, From patchwork Mon Nov 19 10:34:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 151475 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2490101ljp; Mon, 19 Nov 2018 02:35:04 -0800 (PST) X-Google-Smtp-Source: AJdET5eDlYicqOnL+Ou/8udlaEu3YE+iIbICm8QLcg4jO9wCN+jUNHPHOoRYQYPQlTYxqRa+Yd5T X-Received: by 2002:aa7:868f:: with SMTP id d15mr12588043pfo.225.1542623704101; Mon, 19 Nov 2018 02:35:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542623704; cv=none; d=google.com; s=arc-20160816; b=CzmpHrKtkLt+/K19PB5Gz1QhHUMN16P5D2ergwAZZdRKc/REuZ54qkpbmk/xAUv0OJ 7Sn9qCiQ2GmK03QSEdNHkwswh2/N/JtA5bl7xV8l1wB+ZC6pnbagyIEeuuCYYNlGUnyt YTjYhpTqXciE38/frErFb2ybyQ0znf8Gh4fuKlYSyv7ZZHpp0loh0NcSQL++8H9qQUWf +f9PfmOYKd0BQXVzbIslL7WfXly4dH0vO6JPOIke4HOUDQvYVobi/WA4hAlN3AtRlvfq NLfWz4UpgIJjg7tuyzeiPOJJe40+8299m/25VQs14ydwiV01FZJxVj/0z33ApbFKDwBR L96Q== 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; bh=oBc3JwPq73FtDGvqk3t8T7Oot3rzsOXj87W1YQabmq0=; b=GNvgQjsCN2KU3s/hoXcfGUX/d8xfEvMOcZ/V8v8Phqu1u2uQnB2VOaarKHU636yqdt 2v/PdYr4QgR/Zn0GbfdbZZFWefAi+CYk3y8iEoNX1+acRy0MF2UGH48L2gp05zE7cIGZ MlOO6Olb/qbsTd6E/IuhkFlNck3SIVLX2myKUeeev3CXsaf14rCBtLhM40g7XLRRQCHa NXwr2Z8DpIF1PXbrgCRy/o0wY41XRXvzbqtaXrX0Bamsn1LPvTFvq7KCnj4oEBrq8Kke XeY0HssxEjtgABJTYGWAcHHxWsuIZC3X0gRoz0U+HIlWi3j1vKNZ4dq5D/0/+hheAixr Gqxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U+uluio6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j21si21723894pll.150.2018.11.19.02.35.03; Mon, 19 Nov 2018 02:35:04 -0800 (PST) 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=@linaro.org header.s=google header.b=U+uluio6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728407AbeKSU6N (ORCPT + 32 others); Mon, 19 Nov 2018 15:58:13 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44867 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728383AbeKSU6N (ORCPT ); Mon, 19 Nov 2018 15:58:13 -0500 Received: by mail-wr1-f65.google.com with SMTP id j17-v6so31411270wrq.11 for ; Mon, 19 Nov 2018 02:34:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oBc3JwPq73FtDGvqk3t8T7Oot3rzsOXj87W1YQabmq0=; b=U+uluio6KwtbMMoH3Jp0DEoAQtuhcEmvMYrNiM5KHAwwCapWC33wQhLaMnZr9S/I/0 Z6sK2Z1/uUcwEavzu8hwJhNC29Gt2B+bLxPWg0ogiXB9yWoJOlUzzK8ssUxgRpXHV3EU XnLEDqKsSc9kSrVv/zIWFoLbWLaZfx4laO4js= 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=oBc3JwPq73FtDGvqk3t8T7Oot3rzsOXj87W1YQabmq0=; b=WsGQjUToaB2LpC5awbQ4mNvLCVeluPq6ReSPmeSjlCvNUnoeUwLU3XmGzLCoM0Z0Ix 8kDdWJfJVpQTBWtww86EKz/D9JxuZIBx2ycT2fJgIHmtqC7VEJUnCLoX28woQxh4k121 4uTvyl8Qhg+jkvmopoOx+1Yet1N1mbfitEHyQ9JN8qxvJ9STGVlU8HNXVHJV1baTRiMC 2x64PgggedpmrMAKfArFRQQfbI5z2Rcl5cH41+Vv2ZBauOf6QK6VfTXXPXvFjlYxUuIC efhCKCTQU+I31uSBR8NPwPtTRDN4XDvVE2/LSSp1BYFg8UPC9GDLF/M9SVzhop4fujSZ Arbw== X-Gm-Message-State: AGRZ1gKkJYAMsw8nHwMLgqmejzOr+cZMmOvjF6y1tJIUpBU1Z4fSvlvX weVF8YRA3AneXWPGU6qW52v7WQ== X-Received: by 2002:a5d:4708:: with SMTP id y8-v6mr17551672wrq.16.1542623698837; Mon, 19 Nov 2018 02:34:58 -0800 (PST) Received: from localhost.localdomain ([37.162.18.180]) by smtp.gmail.com with ESMTPSA id e9sm14973298wro.16.2018.11.19.02.34.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:34:58 -0800 (PST) From: Paolo Valente To: Jens Axboe , Greg Kroah-Hartman , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Paolo Valente Subject: [PATCH V2 08/10] block, throttle: allow sharing cgroup statistic files Date: Mon, 19 Nov 2018 11:34:22 +0100 Message-Id: <20181119103424.3853-9-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181119103424.3853-1-paolo.valente@linaro.org> References: <20181119103424.3853-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Angelo Ruocco Some of the cgroup files defined in the throttle policy have the same meaning as those defined in the proportional share policy. This commit uses the new file sharing interface in cgroup to share these files. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- block/blk-throttle.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) -- 2.16.1 diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 6bfdaac53b6f..95825448c031 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -1491,22 +1491,30 @@ static struct cftype throtl_legacy_files[] = { .write = tg_set_conf_uint, }, { - .name = "throttle.io_service_bytes", + .name = "io_service_bytes", + .owner_name = "throttle", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_throtl, .seq_show_cft = blkg_print_stat_bytes, }, { - .name = "throttle.io_service_bytes_recursive", + .name = "io_service_bytes_recursive", + .owner_name = "throttle", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_throtl, .seq_show_cft = blkg_print_stat_bytes_recursive, }, { - .name = "throttle.io_serviced", + .name = "io_serviced", + .owner_name = "throttle", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_throtl, .seq_show_cft = blkg_print_stat_ios, }, { - .name = "throttle.io_serviced_recursive", + .name = "io_serviced_recursive", + .owner_name = "throttle", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_throtl, .seq_show_cft = blkg_print_stat_ios_recursive, }, From patchwork Mon Nov 19 10:34:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 151476 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2490140ljp; Mon, 19 Nov 2018 02:35:06 -0800 (PST) X-Google-Smtp-Source: AJdET5dkbwbhmjdi/69iO/NlYc3ST5C0beGIOjYLxuAMk0k1LqYVhTw9hRsH5VYpJK9msKPn+SSi X-Received: by 2002:a65:5c4b:: with SMTP id v11mr19543549pgr.333.1542623706687; Mon, 19 Nov 2018 02:35:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542623706; cv=none; d=google.com; s=arc-20160816; b=J6QaXTsTmokRQeHFvjxbv00iLEn0J75jInbT4nXWH8lMj1Mzu1912GnAEabYpyl2Ew geLL1Tyrg2/H5+cZDH5TsPtu8ugDGCSFMmMrNgJ485SLv5U0fiO0cn/3nMN9L5gV3ShZ D3RLOnooR7U/oys8ETVluKIKWQ+xd12YFIxvLsUyYC+Zm+aYO0VkaMl6Qeh0Orpj2IiP K27OxmzUmqMq57bj0yc+rqN5ZPGvs6z1PbYnDbIjl29kNPndkA/S83UDuWv1mTtSRaLy VvFY51ZdOsG7Lr+OQVCA/WFa7cR9b96HDPHiohi1YJJkulAGzlSvDOHFdgsrtTRV9vNw OCbg== 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; bh=95cHSgXhObq6AUCu/Rr/+wEQTPHLVt9I8/orFJ2tnV8=; b=NGo9kPfqkkSwqaG9B5b/vhd0Gdo7CYRKxBkoB8wlcu/IBrAn9iUzYIrxjxOaSnTz2P sPma/tZM1giJSRgGnOHlzWU91R/I9Zp0sOvzGFm0Sz58u8RUg6yiBPE4An6n+KH/iAZ3 4KHQgzi+IYWdkMtUYh4zrwK32myCPjlsv0oCo/WQs7YePepo+S8qsJoHu0h44UbW+332 1CwD27n/tgTpMV55tAhHcA+oPgMcigSWIZKhxtisbWyqS+hr0hAW1JdfA+aKrpMqV4nj ykohhdRZf9fndtT292UtkrAnQyK/YG+pLT5NmefQ4qcgVckqvMMIR6v7gIuawRP40HuZ ETqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N8iZHEZv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j21si21723894pll.150.2018.11.19.02.35.06; Mon, 19 Nov 2018 02:35:06 -0800 (PST) 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=@linaro.org header.s=google header.b=N8iZHEZv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728425AbeKSU6R (ORCPT + 32 others); Mon, 19 Nov 2018 15:58:17 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37716 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727836AbeKSU6Q (ORCPT ); Mon, 19 Nov 2018 15:58:16 -0500 Received: by mail-wr1-f65.google.com with SMTP id j10so17215636wru.4 for ; Mon, 19 Nov 2018 02:35:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=95cHSgXhObq6AUCu/Rr/+wEQTPHLVt9I8/orFJ2tnV8=; b=N8iZHEZvKWz0J/nual7jk0fkuGeRXXZ7k/3ibe4bHVxzhla7D7v8KTcgOO8yVpWvFT B3vEIw+EBmC/yavIAvjOIiUz2wiAPEAIzT1RHvDAgZUu4MTPxiKzIwxtEJH+JHWk3fW/ YZJUNoJLJnP75HF8BVdkglOlyHl+oOYs6W9pY= 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=95cHSgXhObq6AUCu/Rr/+wEQTPHLVt9I8/orFJ2tnV8=; b=VUlyPSAK/l90oYsdyUHZ6CmM8rfA89ByDNPgOle3YFPfMrB0bdOXJKSxBOzW90mRpY x7gN9w9qObEunRwCB2XB0d616KFxYQ50eJaSmzTqVnEcgPyl4VHhOo8Tjp6uvunPFirO usIdBT9NJOIthFsX//RtKeEa1n0KFlgkHzPGKjUvyimRBHHP7RP5raqTMj1ok8aVf8Xi Lf1qjohKqtWZCmhyskmZWf+KR2mOkOeVNoP4IRqVybZmc4Eq2qSD3njuoDWgYe8W1kYG rFVlwqTzdXXyEvZZUwQ4dxTL0GW709NS1ZA3ZVbSJKP/2tO3U6AnFPR6Pl4ysNRiYwN+ jTwQ== X-Gm-Message-State: AGRZ1gLvPwTN/HvXXl6WZFu48DW7qLSnNTvBHrvdHzbrHp0B5Yfc3Asg 7vsrUrAwlWVdqMC+oR/Cs5qaSQ== X-Received: by 2002:adf:e247:: with SMTP id n7mr16869741wri.205.1542623702316; Mon, 19 Nov 2018 02:35:02 -0800 (PST) Received: from localhost.localdomain ([37.162.18.180]) by smtp.gmail.com with ESMTPSA id e9sm14973298wro.16.2018.11.19.02.34.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:35:01 -0800 (PST) From: Paolo Valente To: Jens Axboe , Greg Kroah-Hartman , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Paolo Valente Subject: [PATCH V2 09/10] doc, bfq-iosched: fix a few clerical errors Date: Mon, 19 Nov 2018 11:34:23 +0100 Message-Id: <20181119103424.3853-10-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181119103424.3853-1-paolo.valente@linaro.org> References: <20181119103424.3853-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit fixes a few clerical errors in Documentation/block/bfq-iosched.txt. Signed-off-by: Paolo Valente --- Documentation/block/bfq-iosched.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.16.1 diff --git a/Documentation/block/bfq-iosched.txt b/Documentation/block/bfq-iosched.txt index 8d8d8f06cab2..6d7dd5ab8554 100644 --- a/Documentation/block/bfq-iosched.txt +++ b/Documentation/block/bfq-iosched.txt @@ -42,7 +42,7 @@ sustainable throughputs, on the same systems as above: BFQ works for multi-queue devices too. -The table of contents follow. Impatients can just jump to Section 3. +The table of contents follows. Impatients can just jump to Section 3. CONTENTS @@ -51,7 +51,7 @@ CONTENTS 1-2 Server systems 2. How does BFQ work? 3. What are BFQ's tunables and how to properly configure BFQ? -4. BFQ group scheduling +4. Group scheduling with BFQ 4-1 Service guarantees provided 4-2 Interface @@ -294,7 +294,7 @@ too. per-process ioprio and weight ----------------------------- -Unless the cgroups interface is used (see "4. BFQ group scheduling"), +Unless the cgroups interface is used (see "4. Group scheduling with BFQ"), weights can be assigned to processes only indirectly, through I/O priorities, and according to the relation: weight = (IOPRIO_BE_NR - ioprio) * 10. From patchwork Mon Nov 19 10:34:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 151477 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2490195ljp; Mon, 19 Nov 2018 02:35:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/UNHtZ3NDho1TsnCldoe0PukPqNVfma6Sh7dBSikOnyc30QhYExKD3C2VkIk0DPSgZTD2G0 X-Received: by 2002:a17:902:4c08:: with SMTP id a8mr1190324ple.74.1542623709896; Mon, 19 Nov 2018 02:35:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542623709; cv=none; d=google.com; s=arc-20160816; b=ME0NUJmyX073exKUfrnsJMOnJWl1DCe5+9Hu4MdUteRNsjTtv7N7gFj53PKRDaawSN Gnno5GH29xRiB6N1URVSZPdGWBamcdvhqXaEhGCY9zInQtOVVMyJpy/0RAwK8WS+9+u1 AEGcN4oSQorQE89ntS7Kddl0EXzcfLW3PdRvxs4s+0Oa3fVJB+eN1qsmZXohaBMwj4TJ Dx9gB2xPmu3IzUJmZxdlPY02z6WI6agoWdySU/LP27wGKFhgz/wbF2VAq7vGpGGhb7ak 8iKk3Hd0Mapyqfd/AsmEdJ/Zr2X3/vwGyGN0cWNc97wm07xT13s+gbRYVJu4bsGxs9aE 0giw== 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; bh=2PZH8WwXkvnGeOOTNTp/CB09k6USJvSSB6C0CaaMGjI=; b=fRwgABBMs9cEvxeXHDVZaKfI/36ckba0kc3pU7dHhtcU0QReQhm6kES6KkJrqNRn8/ q8j5fxBlMrp8cPj8kiIYOI47DxPWnxdLbaEBGdtDQ4XngIs6IV40dQjtuz9/FEshdjr6 lyY4aL4uvO9sz3AVy7Cqg1Vm11cS8Ld3t7zUTh/Kx/5jcAR7HuRHmmAm6QpByfmcKi35 DAKG7JGnFJEA9Y4/rwSdxTX4v3Tlpx0bBL5VkqJ5gHpS/Z/a8x+1Wgex0KeoyarCVIAK 3nDmSHX7Zn4NGp0EoTlKFiCyBPJsPBtWiRhrKuktAmWnge4laUch0EYwvVaS5LQ33X29 U7qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hcuU6/Vq"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si21573830pgv.111.2018.11.19.02.35.09; Mon, 19 Nov 2018 02:35:09 -0800 (PST) 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=@linaro.org header.s=google header.b="hcuU6/Vq"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728444AbeKSU6U (ORCPT + 32 others); Mon, 19 Nov 2018 15:58:20 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:33400 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727836AbeKSU6T (ORCPT ); Mon, 19 Nov 2018 15:58:19 -0500 Received: by mail-wm1-f66.google.com with SMTP id 79so2405024wmo.0 for ; Mon, 19 Nov 2018 02:35:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2PZH8WwXkvnGeOOTNTp/CB09k6USJvSSB6C0CaaMGjI=; b=hcuU6/VqTQwptGHjtIMvqO0p51x14o0CH8VynZz+6pAYFV8wdEQyx+ljlgfV6rV2w7 ITCCyWJsgcX5EmmWYweoyDAMoKM4kZS/0KIuLLINuDr3CFzBBAYSz+58G1YiRCRMTQrt ivc6Bbj1bt5nmThOu57faArw/3BCDnwjUELl8= 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=2PZH8WwXkvnGeOOTNTp/CB09k6USJvSSB6C0CaaMGjI=; b=R7EPKxQUCxhRamez2jd93QBX8CPie6Z+w5uGXvf1X98+pT5zNGVMocftHXsTY3hfmB Ku5kefxs18lH8zi66OGRHU9Hwzy6tpTTXN3xFX9tqeuMJfMcf4CoDJ9FIEc2hIraSMZM uxRl4vHy54Di4p12zONAhoMI+0IMHKKuqJUDBGHRCK/y6x44jj2WX5W8wOImGHuCTJuU 4Pb28kJv+ihXnSfY+aC0VMQwXZG9Pz9C5rzqAOu53qJqeQDt7r9Y9oYXnoIfvpOssi2z hLtQzG03NXjnhq127gxyH0zA6zrLb6+wQe2g3IXXExXITSn9GoDUSCeNfeBt1ooPLbAl kNDw== X-Gm-Message-State: AGRZ1gKFDCWPhOLTklwxcOqnegsMsIQ6b7QJYT6B6WDotEH7nRHOn8WD mHGYceN7gvvaQwRFAxutcfFNVg== X-Received: by 2002:a1c:ddc3:: with SMTP id u186mr6436592wmg.110.1542623705169; Mon, 19 Nov 2018 02:35:05 -0800 (PST) Received: from localhost.localdomain ([37.162.18.180]) by smtp.gmail.com with ESMTPSA id e9sm14973298wro.16.2018.11.19.02.35.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Nov 2018 02:35:04 -0800 (PST) From: Paolo Valente To: Jens Axboe , Greg Kroah-Hartman , Tejun Heo , Li Zefan , Angelo Ruocco , Dennis Zhou , Josef Bacik , Liu Bo , Bart Van Assche , Johannes Weiner Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Jonathan Corbet , Paolo Valente Subject: [PATCH V2 10/10] doc, bfq-iosched: make it consistent with the new cgroup interface Date: Mon, 19 Nov 2018 11:34:24 +0100 Message-Id: <20181119103424.3853-11-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181119103424.3853-1-paolo.valente@linaro.org> References: <20181119103424.3853-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org BFQ now shares interface files with CFQ, for the proportional-share policy. Make documentation consistent with that. Signed-off-by: Paolo Valente --- Documentation/block/bfq-iosched.txt | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) -- 2.16.1 diff --git a/Documentation/block/bfq-iosched.txt b/Documentation/block/bfq-iosched.txt index 6d7dd5ab8554..3d7ef138ce6a 100644 --- a/Documentation/block/bfq-iosched.txt +++ b/Documentation/block/bfq-iosched.txt @@ -508,12 +508,14 @@ process. To get proportional sharing of bandwidth with BFQ for a given device, BFQ must of course be the active scheduler for that device. -Within each group directory, the names of the files associated with -BFQ-specific cgroup parameters and stats begin with the "bfq." -prefix. So, with cgroups-v1 or cgroups-v2, the full prefix for -BFQ-specific files is "blkio.bfq." or "io.bfq." For example, the group -parameter to set the weight of a group with BFQ is blkio.bfq.weight -or io.bfq.weight. +BFQ uses the standard interface files of the proportional-share +policy, previously used by CFQ. If one such file is read/written, then +the operation associated with the file is performed by BFQ for each +device where BFQ is the active scheduler. In addition, BFQ is +configured so as to share interface files with other entities (if some +of these files does happen to be shared, then its associated operation +is performed also by any of the other entities that is using the +file). As for cgroups-v1 (blkio controller), the exact set of stat files created, and kept up-to-date by bfq, depends on whether @@ -521,13 +523,13 @@ CONFIG_DEBUG_BLK_CGROUP is set. If it is set, then bfq creates all the stat files documented in Documentation/cgroup-v1/blkio-controller.txt. If, instead, CONFIG_DEBUG_BLK_CGROUP is not set, then bfq creates only the files -blkio.bfq.io_service_bytes -blkio.bfq.io_service_bytes_recursive -blkio.bfq.io_serviced -blkio.bfq.io_serviced_recursive +blkio.io_service_bytes +blkio.io_service_bytes_recursive +blkio.io_serviced +blkio.io_serviced_recursive The value of CONFIG_DEBUG_BLK_CGROUP greatly influences the maximum -throughput sustainable with bfq, because updating the blkio.bfq.* +throughput sustainable with BFQ, because updating the blkio.* stats is rather costly, especially for some of the stats enabled by CONFIG_DEBUG_BLK_CGROUP. @@ -536,8 +538,8 @@ Parameters to set For each group, there is only the following parameter to set. -weight (namely blkio.bfq.weight or io.bfq-weight): the weight of the -group inside its parent. Available values: 1..10000 (default 100). The +weight (namely blkio.weight or io.weight): the weight of the group +inside its parent. Available values: 1..10000 (default 100). The linear mapping between ioprio and weights, described at the beginning of the tunable section, is still valid, but all weights higher than IOPRIO_BE_NR*10 are mapped to ioprio 0.