From patchwork Mon Nov 12 09:56: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: 10678415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A53B14BA for ; Mon, 12 Nov 2018 09:58:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 658F829F62 for ; Mon, 12 Nov 2018 09:58:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 564E729F64; Mon, 12 Nov 2018 09:58:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E931629F62 for ; Mon, 12 Nov 2018 09:58:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728273AbeKLTtf (ORCPT ); Mon, 12 Nov 2018 14:49:35 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:51439 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728236AbeKLTte (ORCPT ); Mon, 12 Nov 2018 14:49:34 -0500 Received: by mail-wm1-f68.google.com with SMTP id w7-v6so7803770wmc.1 for ; Mon, 12 Nov 2018 01:57: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=gEkvf3D0ybtQ1XCiNuNOR20e0/KEmaDMFTtp87FuqbE=; b=N8KkHvWqCG3FPBQKMMKSv7Pg/NLzZZA7xMvcJW6U01Wj0GNYTuJeCcya4ODW4IlfDY bjeINPfviBlUjWGw0A/F1Z2j5xFDixkEn+Wq8pjVDa2f0IyCUhwOwJnWnNFIaWBeVVTq d85CwbZ1TDnYV7195SRPVFTFCEtIMsDAzsBRA= 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=gEkvf3D0ybtQ1XCiNuNOR20e0/KEmaDMFTtp87FuqbE=; b=Yl1kTcAqxrANG3X0s9p5485E9iu6jI1PEjqUCkzDvRfrZ3/S1zElXHdcSwc8iNj7M4 EN6GeL/Rw4uXfIj3OxOvZ61w7+V1jCO+dp2Vh7b2mN6IPQke1qjLPLx4v0HGahp0N3im YxkIz8gi3JdJvetz3rEQThZAnSGx9VhnBBeKvmLygz0++BJwWojup3oN7kyqUKZdI94x 5ANWFbj/BmifEyNUV3OmLVZvw9vAJdIoTe3BXRfJHctcsUZ3Z5luT0P654cUvaVDmrEJ cszD3LEUzUh35jkFNkDjmdDCAjdEkSeKa/aOicyPeF/fYRJGHKjTY16QER1CBRTtWWKh /Ygg== X-Gm-Message-State: AGRZ1gKdKLcKOd/qjtTytjEol1g5sKDFtP44XBB0E7iihQZtOqoM17BL iVGDYKYYQoihsPquIS3lZODubw== X-Google-Smtp-Source: AJdET5fmKdDKURgKcd0/zNKsqHAs7FIXT38LFwZ+xmQ+O0/jj39RrDDpR/i7+8aP1nLdD0FN0ceDXg== X-Received: by 2002:a1c:3954:: with SMTP id g81-v6mr6728831wma.139.1542016624983; Mon, 12 Nov 2018 01:57:04 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57: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 01/12] kernfs: add function to find kernfs_node without increasing ref counter Date: Mon, 12 Nov 2018 10:56:21 +0100 Message-Id: <20181112095632.69114-2-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Angelo Ruocco The kernfs pseudo file system doesn't export any function to only find a node by name, without also getting a reference on it. But in some cases it is useful to just locate a kernfs node, while using it or not depends on some other condition. This commit adds a function to just look for a node, without getting a reference on it. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- fs/kernfs/dir.c | 13 +++++++++++++ include/linux/kernfs.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 4ca0b5c18192..0003c665869d 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -892,6 +892,19 @@ static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent, return parent; } +struct kernfs_node *kernfs_find(struct kernfs_node *parent, + const unsigned char *name) +{ + struct kernfs_node *kn; + + mutex_lock(&kernfs_mutex); + kn = kernfs_find_ns(parent, name, NULL); + mutex_unlock(&kernfs_mutex); + + return kn; +} +EXPORT_SYMBOL_GPL(kernfs_find); + /** * kernfs_find_and_get_ns - find and get kernfs_node with the given name * @parent: kernfs_node to search under diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 5b36b1287a5a..26e69d285964 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h @@ -309,6 +309,8 @@ void pr_cont_kernfs_path(struct kernfs_node *kn); struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn); struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name, const void *ns); +struct kernfs_node *kernfs_find(struct kernfs_node *parent, + const unsigned char *name); struct kernfs_node *kernfs_walk_and_get_ns(struct kernfs_node *parent, const char *path, const void *ns); void kernfs_get(struct kernfs_node *kn); @@ -391,6 +393,11 @@ static inline struct kernfs_node * kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name, const void *ns) { return NULL; } + +static inline struct kernfs_node * +kernfs_find(struct kernfs_node *parent, const char *name) +{ return NULL; } + static inline struct kernfs_node * kernfs_walk_and_get_ns(struct kernfs_node *parent, const char *path, const void *ns) From patchwork Mon Nov 12 09:56: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: 10678393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C5E813AD for ; Mon, 12 Nov 2018 09:57:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B61929F61 for ; Mon, 12 Nov 2018 09:57:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DE5629F63; Mon, 12 Nov 2018 09:57:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEE0629F61 for ; Mon, 12 Nov 2018 09:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728854AbeKLTtl (ORCPT ); Mon, 12 Nov 2018 14:49:41 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39591 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728268AbeKLTth (ORCPT ); Mon, 12 Nov 2018 14:49:37 -0500 Received: by mail-wm1-f65.google.com with SMTP id u13-v6so7486438wmc.4 for ; Mon, 12 Nov 2018 01:57:08 -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=rpZR9mJwWH7OFtYLISHMCJG8f05AVkaLjpshd/8XLBg=; b=QDGg0Xfc28PGvnVlOCCcIqTsT8u+2STJ/BRHsU4TWNb0Qf39eUTzZBIPZWewRac+F9 r48HnFML9ikjsTAzSxVkv0tFmaCQtYLBMHy0CbrhczPcXAlEm1vn9O3ROOQfl4KxKeZt qrhsIG/0OD+gZ8HfdS87YYirC8OfV4zYGI4ck= 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=rpZR9mJwWH7OFtYLISHMCJG8f05AVkaLjpshd/8XLBg=; b=pWoMB3uenJD8dXdUpnUq+C/AyOYdU8FJJCxpk7PiCA4BVqgOC3OR6fnJVa25TneFJW gM2BSDksYrsIXu/rS4yXE24Bdqm58j02vDu1gs5QJ6rYijm0Rd8fZD33KXExIykKd1eS HGM4vwG8DDNboxOFi6fdrFj+tAvuQhV413natc/8Juc3vPj7HBNZMyY9jMVu3BwUv6+Z rvY2y1hNQkBsZ+H+znXfJTORQ5LGRznbDI84OjP1wyC73g7xW/ZiXFgJm3moxJZZCIpl gvH/6CjyztBWmZA8Mre90qHw+XXPA511nO0FabZin0QT69QRZaEMEzeQBZqxQxTnFhy9 Kx6w== X-Gm-Message-State: AGRZ1gLDS0dPm0mTCmBmSrxBQbYOcJ1dLTfpO6Midniwj+YBpH2TxDHe dtB6KlgGf4zpGNagrLfP+HvOZg== X-Google-Smtp-Source: AJdET5eWLeJkszgxQtsLss1OSpAsy7RqDKp6DgrqNS+c3cAOGNvX8LTc+ygXS4wYZVvjQxFVOOjuEA== X-Received: by 2002:a1c:2097:: with SMTP id g145-v6mr6949615wmg.57.1542016627706; Mon, 12 Nov 2018 01:57:07 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:07 -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 02/12] cgroup: add hook seq_show_cft with also the owning cftype as parameter Date: Mon, 12 Nov 2018 10:56:22 +0100 Message-Id: <20181112095632.69114-3-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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 8b79318810ad..74012b61fe19 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -1448,7 +1448,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) { @@ -3549,17 +3550,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 12 09:56: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: 10678395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABF4614BA for ; Mon, 12 Nov 2018 09:57:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A52829F63 for ; Mon, 12 Nov 2018 09:57:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89D2829F64; Mon, 12 Nov 2018 09:57:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FC6E29F60 for ; Mon, 12 Nov 2018 09:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728798AbeKLTtl (ORCPT ); Mon, 12 Nov 2018 14:49:41 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:51450 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728761AbeKLTtk (ORCPT ); Mon, 12 Nov 2018 14:49:40 -0500 Received: by mail-wm1-f65.google.com with SMTP id w7-v6so7804091wmc.1 for ; Mon, 12 Nov 2018 01:57:11 -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=8xbRyM6QwPa7TVZsyiZmOJOApeuwNEt2y2o/S0ePHa0=; b=EmNZZwfNxLXK+P6tQx6apBYGQYeD6C8RIa624keJp1BJlk5x/qN/qirqT4XkSmOAkq /+MRYyGr+IN8WALypACSG/I8SRvN90v3VTp3FyYlO2QfuIuX257rruignxy0lyfCdeZH T934WlYeKBKyynLJaUKmGv3j+IPC6QaR8kzFw= 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=8xbRyM6QwPa7TVZsyiZmOJOApeuwNEt2y2o/S0ePHa0=; b=PeTdaBBPcAn5BBpYzuGT7Ri9Esit2NJVtEGuEP19TKxdTaVx7uLxU/KWumn7GgCLR3 gs3CtME6nefTZjusPTI+qfRKMbYEn+YoimDG4MITa3vV/EfNkImGVOm1IYsPuOHw/u5B 2XrolAgq6a3aFRZiU3Xz7c5xPlvTjE6sJvzfR2USUam1jv3mo3sdAwebeSixSehn4w9s Dj+rHI1eOanyjq8+1r6aRbt3cnjr+wmyx0+ejFivTMujvGR1TR2ejSZQgGcK1CnA3Zf+ 94dwljxnt6f+xOeoXzwlmdE6cpP18MiWsY+CnB/0scbDy172cROUzHf2gOxlWWNqXiG3 tMkg== X-Gm-Message-State: AGRZ1gK8lGJUU8Q8Zu5kOC0KnmqsKfQfBfz2LhTMnOStWqbTyQoJKt7j tG8FVpfs6ucclT+nETTLCVYY4w== X-Google-Smtp-Source: AJdET5fg4aq0ZV1vcKUmkiDlbhpzOdkpCPmWchm3hBog2cZg4d3ayTkSaGbBmCOhOmBhhylE4nysMA== X-Received: by 2002:a1c:ae4a:: with SMTP id x71-v6mr6982936wme.125.1542016630787; Mon, 12 Nov 2018 01:57:10 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:09 -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 03/12] block, cgroup: pass cftype to functions that need to use it Date: Mon, 12 Nov 2018 10:56:23 +0100 Message-Id: <20181112095632.69114-4-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 +++---- block/cfq-iosched.c | 56 ++++++++++++++++++++++++---------------------- include/linux/blk-cgroup.h | 10 +++++---- 5 files changed, 81 insertions(+), 69 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index d9a7916ff0ab..50b2d7ba6b9d 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 992da5592c6e..f173e7437203 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -667,15 +667,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; } @@ -684,15 +685,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; } @@ -710,13 +712,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; } @@ -725,13 +729,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 4bda70e8db48..5c43821dc528 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/block/cfq-iosched.c b/block/cfq-iosched.c index 6a3d87dd3c1a..af0c59c2dcde 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -1884,17 +1884,17 @@ static int cfq_set_leaf_weight(struct cgroup_subsys_state *css, return __cfq_set_weight(css, val, false, false, true); } -static int cfqg_print_stat(struct seq_file *sf, void *v) +static int cfqg_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_cfq, seq_cft(sf)->private, false); + &blkcg_policy_cfq, cft->private, false); return 0; } -static int cfqg_print_rwstat(struct seq_file *sf, void *v) +static int cfqg_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_cfq, seq_cft(sf)->private, true); + &blkcg_policy_cfq, cft->private, true); return 0; } @@ -1914,19 +1914,21 @@ static u64 cfqg_prfill_rwstat_recursive(struct seq_file *sf, return __blkg_prfill_rwstat(sf, pd, &sum); } -static int cfqg_print_stat_recursive(struct seq_file *sf, void *v) +static int cfqg_print_stat_recursive(struct seq_file *sf, struct cftype *cft, + void *v) { blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), cfqg_prfill_stat_recursive, &blkcg_policy_cfq, - seq_cft(sf)->private, false); + cft->private, false); return 0; } -static int cfqg_print_rwstat_recursive(struct seq_file *sf, void *v) +static int cfqg_print_rwstat_recursive(struct seq_file *sf, struct cftype *cft, + void *v) { blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), cfqg_prfill_rwstat_recursive, &blkcg_policy_cfq, - seq_cft(sf)->private, true); + cft->private, true); return 0; } @@ -2034,7 +2036,7 @@ static struct cftype cfq_blkcg_legacy_files[] = { { .name = "time", .private = offsetof(struct cfq_group, stats.time), - .seq_show = cfqg_print_stat, + .seq_show_cft = cfqg_print_stat, }, { .name = "sectors", @@ -2043,39 +2045,39 @@ static struct cftype cfq_blkcg_legacy_files[] = { { .name = "io_service_bytes", .private = (unsigned long)&blkcg_policy_cfq, - .seq_show = blkg_print_stat_bytes, + .seq_show_cft = blkg_print_stat_bytes, }, { .name = "io_serviced", .private = (unsigned long)&blkcg_policy_cfq, - .seq_show = blkg_print_stat_ios, + .seq_show_cft = blkg_print_stat_ios, }, { .name = "io_service_time", .private = offsetof(struct cfq_group, stats.service_time), - .seq_show = cfqg_print_rwstat, + .seq_show_cft = cfqg_print_rwstat, }, { .name = "io_wait_time", .private = offsetof(struct cfq_group, stats.wait_time), - .seq_show = cfqg_print_rwstat, + .seq_show_cft = cfqg_print_rwstat, }, { .name = "io_merged", .private = offsetof(struct cfq_group, stats.merged), - .seq_show = cfqg_print_rwstat, + .seq_show_cft = cfqg_print_rwstat, }, { .name = "io_queued", .private = offsetof(struct cfq_group, stats.queued), - .seq_show = cfqg_print_rwstat, + .seq_show_cft = cfqg_print_rwstat, }, /* the same statictics which cover the cfqg and its descendants */ { .name = "time_recursive", .private = offsetof(struct cfq_group, stats.time), - .seq_show = cfqg_print_stat_recursive, + .seq_show_cft = cfqg_print_stat_recursive, }, { .name = "sectors_recursive", @@ -2084,32 +2086,32 @@ static struct cftype cfq_blkcg_legacy_files[] = { { .name = "io_service_bytes_recursive", .private = (unsigned long)&blkcg_policy_cfq, - .seq_show = blkg_print_stat_bytes_recursive, + .seq_show_cft = blkg_print_stat_bytes_recursive, }, { .name = "io_serviced_recursive", .private = (unsigned long)&blkcg_policy_cfq, - .seq_show = blkg_print_stat_ios_recursive, + .seq_show_cft = blkg_print_stat_ios_recursive, }, { .name = "io_service_time_recursive", .private = offsetof(struct cfq_group, stats.service_time), - .seq_show = cfqg_print_rwstat_recursive, + .seq_show_cft = cfqg_print_rwstat_recursive, }, { .name = "io_wait_time_recursive", .private = offsetof(struct cfq_group, stats.wait_time), - .seq_show = cfqg_print_rwstat_recursive, + .seq_show_cft = cfqg_print_rwstat_recursive, }, { .name = "io_merged_recursive", .private = offsetof(struct cfq_group, stats.merged), - .seq_show = cfqg_print_rwstat_recursive, + .seq_show_cft = cfqg_print_rwstat_recursive, }, { .name = "io_queued_recursive", .private = offsetof(struct cfq_group, stats.queued), - .seq_show = cfqg_print_rwstat_recursive, + .seq_show_cft = cfqg_print_rwstat_recursive, }, #ifdef CONFIG_DEBUG_BLK_CGROUP { @@ -2119,27 +2121,27 @@ static struct cftype cfq_blkcg_legacy_files[] = { { .name = "group_wait_time", .private = offsetof(struct cfq_group, stats.group_wait_time), - .seq_show = cfqg_print_stat, + .seq_show_cft = cfqg_print_stat, }, { .name = "idle_time", .private = offsetof(struct cfq_group, stats.idle_time), - .seq_show = cfqg_print_stat, + .seq_show_cft = cfqg_print_stat, }, { .name = "empty_time", .private = offsetof(struct cfq_group, stats.empty_time), - .seq_show = cfqg_print_stat, + .seq_show_cft = cfqg_print_stat, }, { .name = "dequeue", .private = offsetof(struct cfq_group, stats.dequeue), - .seq_show = cfqg_print_stat, + .seq_show_cft = cfqg_print_stat, }, { .name = "unaccounted_time", .private = offsetof(struct cfq_group, stats.unaccounted_time), - .seq_show = cfqg_print_stat, + .seq_show_cft = cfqg_print_stat, }, #endif /* CONFIG_DEBUG_BLK_CGROUP */ { } /* terminate */ diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 1e76ceebeb5d..7e016338724e 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -212,10 +212,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 12 09:56: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: 10678397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8169C14BA for ; Mon, 12 Nov 2018 09:57:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C5FE29F60 for ; Mon, 12 Nov 2018 09:57:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6019929F62; Mon, 12 Nov 2018 09:57:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB16E29F60 for ; Mon, 12 Nov 2018 09:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729139AbeKLTto (ORCPT ); Mon, 12 Nov 2018 14:49:44 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34930 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728832AbeKLTtn (ORCPT ); Mon, 12 Nov 2018 14:49:43 -0500 Received: by mail-wr1-f67.google.com with SMTP id z16-v6so8585732wrv.2 for ; Mon, 12 Nov 2018 01:57:14 -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=symMBI0AEZzZj3jXIeKSzDkA196PYWRtmcxOC8y15f0=; b=PLZQsYk8zx5Q6H+H+XLenq9zy5WTTXzbjsINOjU45dyhex93N5hCav2aGJsu5FmV2p TwXAeQNkschEKoKPJaFtk3IKly/y954thUgWArusiHRfCOorjEt67znBLPbkOXdFz+uH jkwbbS5vgHj6TxcDWHCYS9W4Y1QoGNib19Qyw= 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=symMBI0AEZzZj3jXIeKSzDkA196PYWRtmcxOC8y15f0=; b=pVV6/WUKcXnSYSyZUoQS6BL5Y6sZefk1yfoYTxbgEmJHGMOFZ+ia/1WQ3JFYusowkc a7d6aOL+UT7y4LF+lLN0pfpNOzAD8LdiNB1zU1Ycb6ljhUAvQ7sxEqKOfjVEP+UQro+0 S+bEdzvNWcvqcYs15qSiSDA7WA25zss7RrcqO9qTBDOP5ebCQfLUXRyasw9yZWeBhuS7 +VSknqgbj871slfbtKGAH+gghoW1TcPrVuofqaDhpIXIKieNBJ+jJ3J23twaygU9+8Ip tjnQudittrlBX/skKfBPjGEdvF3wcHt/I14LLaixpk/xvn5YUDHyaRDzsNQSHZoaWocP uBgQ== X-Gm-Message-State: AGRZ1gK5uzsBeOh/sTi4rngPsqS0rxQ/8Wx8Pw1kT4QOir/ItNBn+2+B HtDECQmIIm+iO0Q/3SepC7tZaw== X-Google-Smtp-Source: AJdET5c7zXbGapx4ROwQiCCoDFHoiCdXuVcP9QnHz9lDONpVPiq7dXyqARUVk/+ujQMIQmFTTgTqJw== X-Received: by 2002:adf:f8d0:: with SMTP id f16-v6mr292162wrq.265.1542016633209; Mon, 12 Nov 2018 01:57:13 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:12 -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 04/12] cgroup: link cftypes of the same subsystem with the same name Date: Mon, 12 Nov 2018 10:56:24 +0100 Message-Id: <20181112095632.69114-5-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Angelo Ruocco When a cgroup policy is activated, it creates its files in its subsystem directory. Two policies are not able to create a file with the same name: if a policy tries to create a file that has the same name as a file created by another policy, the cgroup core stops it, warns the user about the error, and then proceeds to delete all the files created by the last policy. However, in some specific situations, it may be useful for two or more policies to use a common file, e.g., the I/O schedulers bfq and cfq have the same "weight" attribute, that changes the behavior of the two schedulers in a similar way. This commit prepares the interface that allows two policies of the same subsystem 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(-) 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 74012b61fe19..e3cc437669a8 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -1579,9 +1579,12 @@ 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(cgrp->kn, + cgroup_file_name(cgrp, cft, name)); + struct cftype *cfts = kn->priv; lockdep_assert_held(&cgroup_mutex); @@ -1596,7 +1599,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); + } } /** @@ -3467,6 +3482,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; @@ -3615,6 +3631,23 @@ 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 = kernfs_find(cgrp->kn, cgroup_file_name(cgrp, cft, name)); + if (kn) { + struct cftype *cfts = kn->priv; + + if (cfts->flags & CFTYPE_SHARES_FILE) { + /* + * kn->count keeps track of how many cftypes + * share kn + */ + kernfs_get(kn); + goto out_set_cfile; + } + } + } + kn = __kernfs_create_file(cgrp->kn, cgroup_file_name(cgrp, cft, name), cgroup_file_mode(cft), GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, @@ -3629,6 +3662,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; @@ -3726,11 +3760,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; @@ -3760,6 +3829,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 12 09:56:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 10678413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C523D13AD for ; Mon, 12 Nov 2018 09:58:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B42E829F62 for ; Mon, 12 Nov 2018 09:58:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A824029F64; Mon, 12 Nov 2018 09:58:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F66729F62 for ; Mon, 12 Nov 2018 09:58:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729157AbeKLTtq (ORCPT ); Mon, 12 Nov 2018 14:49:46 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:33628 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727185AbeKLTtp (ORCPT ); Mon, 12 Nov 2018 14:49:45 -0500 Received: by mail-wm1-f66.google.com with SMTP id f19-v6so8476574wmb.0 for ; Mon, 12 Nov 2018 01:57:16 -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=P7bU520jYWPTb3cyPzcSyUy1YpHK+qexJMs0P6lqanE=; b=JtQQC93arLRCUkYIzxYNMaBRBMon6J3hW9n1Xxh71Mx0tPT2003ZczFsHzJ42mmoOX CFbUgZR3B0Jz5VRmHN1WePt8B0KRBQkeu6YZZjQxZMnpbSTRsYSnZaaMTfMQXbgZ9JGD le/9K33CGl4PFQx+RuuGtMEVzyJUE113m9ick= 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=P7bU520jYWPTb3cyPzcSyUy1YpHK+qexJMs0P6lqanE=; b=pVD5k/+p1F1YxbE2S53YeRxpF8q8o6moAHYsl0jktpQPSVFqGdnTyk8aG/mPbXZdmt c4/ap1o5g+qlAO3eVbDD8giRTrD9WpJtaDm+kIy62LNFf0kCqZXq0IGHB89LgyoeXsIU rdUgqLlrkdu1keUhatZYDIb/8bynnJTP+zRtRrl3bicCsKtJL7/K8vVIzlVRX2R8Rrsc LhTIZ1/KVV5425xrLg3FcvtAh2p6uv+kXPzzQo5Cd7RsjXDrR61TBcpmAWFioniyWS6X /YFnzIf9AsbQfTkpparHPfEm1QzgEA8H+8+lWkQpPJ+pj0f02a70uKiJhMiKFq7uhHQK 3C9g== X-Gm-Message-State: AGRZ1gLfHBvOInP34pmIi1N1fRlALfGNKTZxkOOzxjmWxAtbcUsTbRjq k8N+AqNZmrL55ZaDPjlkKaZvRg== X-Google-Smtp-Source: AJdET5fOPU/wEBvlrP6ob154UM+loSKSJ6hxBJmlftnunIrjo0kJIOyXnAZ6VBhayyAA8PJXPnmG9w== X-Received: by 2002:a1c:b5ce:: with SMTP id e197-v6mr6848082wmf.30.1542016635664; Mon, 12 Nov 2018 01:57:15 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:15 -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 05/12] cgroup: add owner name to cftypes Date: Mon, 12 Nov 2018 10:56:25 +0100 Message-Id: <20181112095632.69114-6-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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 9968332cceed..bf17a9843f45 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -293,6 +293,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 12 09:56:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 10678411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D68213AD for ; Mon, 12 Nov 2018 09:58:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BA4E29F62 for ; Mon, 12 Nov 2018 09:58:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F93429F64; Mon, 12 Nov 2018 09:58:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D0AB29F62 for ; Mon, 12 Nov 2018 09:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728706AbeKLTud (ORCPT ); Mon, 12 Nov 2018 14:50:33 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34939 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728796AbeKLTtq (ORCPT ); Mon, 12 Nov 2018 14:49:46 -0500 Received: by mail-wr1-f68.google.com with SMTP id z16-v6so8586006wrv.2 for ; Mon, 12 Nov 2018 01:57:18 -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=P3gM8CEth45UYnNHSZF98Zi/zDAo21J+oNJpFvTMXDU=; b=F+07G256OoZzsTmnbt0RELuT0heBN/K8A2OrFVYc5axzgzepR5T2xKkZNXlibAtKAJ 809E2WdhkOSlr2VxSQawiDZ9b1WIzjE9faJ7tuvvOP/NGFenBt5I92R4MWTVciVtbKU9 TdhCVPR+K7VkxBtuZ276fOv470Q1nrjMDL6vk= 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=P3gM8CEth45UYnNHSZF98Zi/zDAo21J+oNJpFvTMXDU=; b=FABa8pRvj9GPvRXPlpkI5gWrcVgYz5a22nm/xSlPmiU9BKv9xh+zkRf3z95KLvEh9t HcjPJlUN0Ph2D/EeozqS719PjfO8mOo9j1KTHJCR4hSd3ttjDEpWoDXzt4/gJw9dMtzi k6Fa+a3NCuHEszrfp3RDSU3bmU+x3mF/nQ0toYxX8sEfnZKg7GBHPXidTG2/q/FjRatt viW+14uMYl+MlZxrydD/wAiVPhcKVEaGomLypi2ZBdtA7gGGTPozFZtS/QL36LzdjG3A FhE1p5eQK8EbDBvnmT50kKl/v8nb4SrmLPLrVc32Bcl8OrltYzVLp+ogPuX+mTU+FKMV wlrA== X-Gm-Message-State: AGRZ1gJIsr+7oNs7fhJjYzlYxP2RsJ2Bq+gf4bLOms1qt8a6O/sXznvw f0utqYlinIYe3PA4XaLSje7YoA== X-Google-Smtp-Source: AJdET5dmQXJVy08gMpQhoMpmynlctBhE45z6FLv3NNiUP+8moCL8RqcGeq1AsRtgkq2/wuSqduDtxw== X-Received: by 2002:a5d:5544:: with SMTP id g4-v6mr311353wrw.222.1542016637942; Mon, 12 Nov 2018 01:57:17 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:17 -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 06/12] block, bfq: align min and default weights with cfq Date: Mon, 12 Nov 2018 10:56:26 +0100 Message-Id: <20181112095632.69114-7-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Angelo Ruocco The I/O schedulers bfq and cfq expose a cgroup attribute with the same meaning: weight. This commit changes bfq default and min weights to match the ones set by cfq. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- block/bfq-iosched.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 12 09:56:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 10678409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E85D514BA for ; Mon, 12 Nov 2018 09:58:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4A5E29F60 for ; Mon, 12 Nov 2018 09:58:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C676929F62; Mon, 12 Nov 2018 09:58:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 269D229F60 for ; Mon, 12 Nov 2018 09:58:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729281AbeKLTtv (ORCPT ); Mon, 12 Nov 2018 14:49:51 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34342 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729239AbeKLTtu (ORCPT ); Mon, 12 Nov 2018 14:49:50 -0500 Received: by mail-wr1-f68.google.com with SMTP id j26-v6so8574836wre.1 for ; Mon, 12 Nov 2018 01:57:21 -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=z1yDznB1zlUn9X3/WRtGxgozB4Whpg1+Jm0y+uUAhQs=; b=PyZ8gOJocogy3BEEQogAOEoynZMxE8x1fvBu0cP2+n30x2NDzxjSXsAPqPzS7QF2yn 559MfbGKyuGBpBtaanAwzOoQhFxdw4OpTCdGb2uaAZpuWQhrfq2eoWDkvEvCAEIUZ6/X Pmr2XAYw4kpma6U7p99Xbla+MYZenfrHl3AVM= 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=z1yDznB1zlUn9X3/WRtGxgozB4Whpg1+Jm0y+uUAhQs=; b=EsvaSIky42qFkOflG4tNKQzt1rlsahc6zpC3EjP1RTIJL3Y9O6OHcwLUjZFzCdyYsW kBvD9ZljoFzwKh/1hVhwOfl8Cxhqc4jW8VdHErwiQkjaVDZtSh1y377DfHkZanKcGYdK JcFXq5yQAFd4TyKMER2K1Y3rszRYLqIv1O6Hd6ZJrxrZuB4hHOqY3tK5Zy/uAYFFzSOw WFcEnftIj4UYR5SAi3023wOoD6m3lKofZL2DN8dFhwLCuE86ZEVkDree3gXwjxUMJzjg +D6yyrC3HLE5gqLq/KYNIaVxDaw5KTjl7GoIGZZHDCXj6bNAoUrwbbLOFAqZsX+dEjhS aecg== X-Gm-Message-State: AGRZ1gIRv0Nx1VYZ867iHBRWmD2dNW9fI4WbpjZoK8QwRwkgHFe6qHTT NjqVgf4Bo+57TaJkEzRDdeBQ/A== X-Google-Smtp-Source: AJdET5cNricL6ewA3bg6OKKhOdQerlzg7sQ1hwsx5lzQkbAPiYr3jhHML+GAlyn5W5yKLyQBSw+HkQ== X-Received: by 2002:a5d:4a11:: with SMTP id m17-v6mr273341wrq.259.1542016640333; Mon, 12 Nov 2018 01:57:20 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:19 -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 07/12] cgroup: make all functions of all cftypes be invoked Date: Mon, 12 Nov 2018 10:56:27 +0100 Message-Id: <20181112095632.69114-8-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Angelo Ruocco When two or more policies 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(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index e3cc437669a8..6d4cfd6395ec 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -3481,66 +3481,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; @@ -3562,22 +3603,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 12 09:56:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 10678399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BACD13AD for ; Mon, 12 Nov 2018 09:57:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A9A629F60 for ; Mon, 12 Nov 2018 09:57:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E36529F62; Mon, 12 Nov 2018 09:57:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A25DE29F60 for ; Mon, 12 Nov 2018 09:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726207AbeKLTty (ORCPT ); Mon, 12 Nov 2018 14:49:54 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54612 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729279AbeKLTtx (ORCPT ); Mon, 12 Nov 2018 14:49:53 -0500 Received: by mail-wm1-f67.google.com with SMTP id r63-v6so7828962wma.4 for ; Mon, 12 Nov 2018 01:57:23 -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=BhhSrhl3GPkKSUoXIhn9nAMo7Bh19cGOMzxu3Gi9vPg=; b=QG+hymxrp0k2JHc1mCXq7bGzmIVfKn8kyei84SG0+Y3J9yu8gRuP/KiUBxNO6H35Yw PAM/xy0h10htiE9hYdXK9BcdZPCqgmM0bjBMsEt8TvvDzFJTQMZNtCgl4n1iF4YqNIE/ nqEomghns5VaEzxAIC/4QDraAfkZx5bQG9Ixk= 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=BhhSrhl3GPkKSUoXIhn9nAMo7Bh19cGOMzxu3Gi9vPg=; b=RBW7R48v0OTvA/a3i+RazPS1wWGAw9Wfz0BkY1NDYamX8kOVeVTQVy3SInBEACYbnH MW0GQCtbZQ5qgJqioGn0JUCkm9GqotAudvklWM0SXZyheYq62dVex6Yn35MMAJOyjWow hjg56TilexibPKMRszUnAPYbc9Au5B6fIRsZBB2kfZ+Vz6BfnMDFWyWex5oQ1UJAYyIz SavpOXX2jrKVVErCYVpWMU4EtN+VYBW8JUu/vvYV7ncfFONMfbibetmmjURX1s1lEmRq pDHP7lK+wAAgWhXviwLr0ej+51VzvFpiztVhmIU+Yptgnyyn8tWPw9Z6nBkjCYu7Zbp4 e68g== X-Gm-Message-State: AGRZ1gIqkIS0gbwy1/L+/xnVPbnr5ocqk86/i0xwnsB0Ccr/pVbvlvZh cyS/y+VUSMAe2wIY4YkYjMgnhA== X-Google-Smtp-Source: AJdET5ciK+vocmPu6b60UpX73AaZ1OTTiPWtswUD/U+3dbiFmTt0CYEpBhnfnlzDg3PvsctIzLIX7w== X-Received: by 2002:a1c:3c83:: with SMTP id j125-v6mr6771922wma.65.1542016642661; Mon, 12 Nov 2018 01:57:22 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:22 -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 08/12] block, cfq: allow cgroup files to be shared Date: Mon, 12 Nov 2018 10:56:28 +0100 Message-Id: <20181112095632.69114-9-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Angelo Ruocco Some of the files exposed in a cgroup by cfq have the same meaning as the files exposed by bfq and throttle. This commit allows these files to be shared. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- block/cfq-iosched.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index af0c59c2dcde..f046039bdfc6 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -2016,7 +2016,8 @@ static struct cftype cfq_blkcg_legacy_files[] = { }, { .name = "weight", - .flags = CFTYPE_NOT_ON_ROOT, + .owner_name = "cfq", + .flags = CFTYPE_NOT_ON_ROOT | CFTYPE_SHARES_FILE, .seq_show = cfq_print_weight, .write_u64 = cfq_set_weight, }, @@ -2035,40 +2036,56 @@ static struct cftype cfq_blkcg_legacy_files[] = { /* statistics, covers only the tasks in the cfqg */ { .name = "time", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.time), .seq_show_cft = cfqg_print_stat, }, { .name = "sectors", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .seq_show = cfqg_print_stat_sectors, }, { .name = "io_service_bytes", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_cfq, .seq_show_cft = blkg_print_stat_bytes, }, { .name = "io_serviced", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_cfq, .seq_show_cft = blkg_print_stat_ios, }, { .name = "io_service_time", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.service_time), .seq_show_cft = cfqg_print_rwstat, }, { .name = "io_wait_time", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.wait_time), .seq_show_cft = cfqg_print_rwstat, }, { .name = "io_merged", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.merged), .seq_show_cft = cfqg_print_rwstat, }, { .name = "io_queued", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.queued), .seq_show_cft = cfqg_print_rwstat, }, @@ -2076,70 +2093,97 @@ static struct cftype cfq_blkcg_legacy_files[] = { /* the same statictics which cover the cfqg and its descendants */ { .name = "time_recursive", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.time), .seq_show_cft = cfqg_print_stat_recursive, }, { .name = "sectors_recursive", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .seq_show = cfqg_print_stat_sectors_recursive, }, { .name = "io_service_bytes_recursive", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_cfq, .seq_show_cft = blkg_print_stat_bytes_recursive, }, { .name = "io_serviced_recursive", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = (unsigned long)&blkcg_policy_cfq, .seq_show_cft = blkg_print_stat_ios_recursive, }, { .name = "io_service_time_recursive", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.service_time), .seq_show_cft = cfqg_print_rwstat_recursive, }, { .name = "io_wait_time_recursive", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.wait_time), .seq_show_cft = cfqg_print_rwstat_recursive, }, { .name = "io_merged_recursive", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.merged), .seq_show_cft = cfqg_print_rwstat_recursive, }, { .name = "io_queued_recursive", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.queued), .seq_show_cft = cfqg_print_rwstat_recursive, }, #ifdef CONFIG_DEBUG_BLK_CGROUP { .name = "avg_queue_size", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .seq_show = cfqg_print_avg_queue_size, }, { .name = "group_wait_time", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.group_wait_time), .seq_show_cft = cfqg_print_stat, }, { .name = "idle_time", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.idle_time), .seq_show_cft = cfqg_print_stat, }, { .name = "empty_time", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.empty_time), .seq_show_cft = cfqg_print_stat, }, { .name = "dequeue", + .owner_name = "cfq", + .flags = CFTYPE_SHARES_FILE, .private = offsetof(struct cfq_group, stats.dequeue), .seq_show_cft = cfqg_print_stat, }, { .name = "unaccounted_time", + .owner_name = "cfq", .private = offsetof(struct cfq_group, stats.unaccounted_time), .seq_show_cft = cfqg_print_stat, }, @@ -2181,7 +2225,8 @@ static ssize_t cfq_set_weight_on_dfl(struct kernfs_open_file *of, static struct cftype cfq_blkcg_files[] = { { .name = "weight", - .flags = CFTYPE_NOT_ON_ROOT, + .owner_name = "cfq", + .flags = CFTYPE_NOT_ON_ROOT | CFTYPE_SHARES_FILE, .seq_show = cfq_print_weight_on_dfl, .write = cfq_set_weight_on_dfl, }, From patchwork Mon Nov 12 09:56:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 10678401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C788714BA for ; Mon, 12 Nov 2018 09:57:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B75F429F60 for ; Mon, 12 Nov 2018 09:57:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB42329F62; Mon, 12 Nov 2018 09:57:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FDCD29F60 for ; Mon, 12 Nov 2018 09:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729150AbeKLTt5 (ORCPT ); Mon, 12 Nov 2018 14:49:57 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52861 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729339AbeKLTtz (ORCPT ); Mon, 12 Nov 2018 14:49:55 -0500 Received: by mail-wm1-f68.google.com with SMTP id r11-v6so7788524wmb.2 for ; Mon, 12 Nov 2018 01:57:26 -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=0oaKQg1Db4rRhO3WCbNaQdRbhtsjokz1BpBDDqQDnH0=; b=Rg5OfuRnIxfiEqH0WAirw+p5zFFM2A3eP+/qNVgYtz/p1XWMtJQwYM05UW/C4+j5gX IaZnE3XI6wvJCXcd4FQ1Hx5aghznqX87ea65MY8LBS1tfU6fXt06wlGlTPcLKrs9JP1t 5iM+S+o9ye6yz2LV6kWJfSIofPFST2APQ3GVM= 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=0oaKQg1Db4rRhO3WCbNaQdRbhtsjokz1BpBDDqQDnH0=; b=ifRIlJq+yue1jgvvzIPwFk3ROKJcbsHSZc6nMJ8ZT9LTNHrrOG4jijaqkPE8jdc389 6Ih+oSV6yUNrkLWYuKJm5lvuvf2u7t7UA8jwTHJ4kg+LuUsC2/ZLlB5lONL7pjJaBlLv SPVkwBbZo6RdBGHt691lEE1s8PUAW9IfyYxKe826nQ+o0GTQvhg7ze3miOSPD63vU9MI G8eH8K5yd8WBhOb2QZHOIFwIt59UFo7yUAElPRaWdTc4WqM7gXCvrJ3LUIt5RfhXZVph yDy+VC80NQKuoKlq6tSjk6Vippa+frK1/G+fWcQqUm0SO53SbMfnhZAqHSXRrWZwp0Ps WG1w== X-Gm-Message-State: AGRZ1gK+IlJ45aXlcGtTKnok6J7D8SKwdqaCj9rp+cyUPDIPVdP0DZkB sfbTmVNedT0mT3M0ljG+STqW1w== X-Google-Smtp-Source: AJdET5dc+MYjthZUBqOb8v1Uac6VYFwMsLxCFBwUwclICSmMMWw45pmt4ZJKD8ArEZEhDeAuhckI4w== X-Received: by 2002:a7b:c84f:: with SMTP id c15-v6mr6284511wml.79.1542016645423; Mon, 12 Nov 2018 01:57:25 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:24 -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 09/12] block, bfq: use standard file names for the proportional-share policy Date: Mon, 12 Nov 2018 10:56:29 +0100 Message-Id: <20181112095632.69114-10-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. 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 share these files with any other policy. Signed-off-by: Angelo Ruocco Signed-off-by: Paolo Valente --- block/bfq-cgroup.c | 94 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 69 insertions(+), 25 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index 50b2d7ba6b9d..9148fc38c737 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 12 09:56:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 10678407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 484E014BA for ; Mon, 12 Nov 2018 09:57:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 382D829F60 for ; Mon, 12 Nov 2018 09:57:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C06929F62; Mon, 12 Nov 2018 09:57:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C801929F60 for ; Mon, 12 Nov 2018 09:57:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729279AbeKLTt6 (ORCPT ); Mon, 12 Nov 2018 14:49:58 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36355 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729345AbeKLTt5 (ORCPT ); Mon, 12 Nov 2018 14:49:57 -0500 Received: by mail-wm1-f67.google.com with SMTP id v70-v6so7062286wmd.1 for ; Mon, 12 Nov 2018 01:57:28 -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=tJzqIZ4whiBiBt1HUGz+jcfYWcwBBnR88Hf7l4Y3mww=; b=FDIijxyzwzKUw8K/20a1vK7NhMkivhaxGdBShwBbInbBKMPrlnQRfW4Q14WNLJlAgk +5kolkin8wKT5bN1KavHsyCPbdwxMplfi0IRkntZ056n0gKQV+UuCM8samekxvyVvzGV rA+3TSy9ixB0Rhl9TjcTj+dGLIzKf73wxGTX4= 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=tJzqIZ4whiBiBt1HUGz+jcfYWcwBBnR88Hf7l4Y3mww=; b=XTzj2/ovxnjC+5VExddViEcQbjwXdoF7ZmsyKaFWbquEq5OecSei/9d/Znv0YHZdZ5 iGlh+TphLVQTkNkOm8B+29KBypDkIvdgSJt4y5Fd3gFcHh07K2fS5q9kfBagCVnIsYDt H/MobYn/KsQgehYOjuuofAu+a2VQtcISPf7vBhe8q4RrDaxYgjqa7g+5hKnl9R5ryFWe 6fCn973awtgaJ5HPUceGS41vm2C+3u7NfT9OiBLTQnIOY778ATCJKzMoV+I8Yo3BJaQP dmwyzWs8A2aDwS1JnWuibiF5hA714cWPYE2uskHLeJx+yCKVIIL5/GIfG8LG/gM6l0hl 2WuQ== X-Gm-Message-State: AGRZ1gLs3Lw+X5MGGC5CeKLxM4IJqDv/P45sMnrs2cf/rfMUarguzrgS 7OXg9m2CEALvTptFIBYeVknBOA== X-Google-Smtp-Source: AJdET5fawr7GnsFjWBfAqQNwc0WTsbuL0TF0A5Vo5Qb1Eh1UMzTSTTRDuv41Dqraj6jvyVn0dIwu2g== X-Received: by 2002:a1c:58c5:: with SMTP id m188-v6mr6705885wmb.85.1542016647902; Mon, 12 Nov 2018 01:57:27 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:27 -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 10/12] block, throttle: allow sharing cgroup statistic files Date: Mon, 12 Nov 2018 10:56:30 +0100 Message-Id: <20181112095632.69114-11-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 5c43821dc528..239957c12d34 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 12 09:56:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 10678405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C703B13AD for ; Mon, 12 Nov 2018 09:57:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B33A329F60 for ; Mon, 12 Nov 2018 09:57:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A707E29F62; Mon, 12 Nov 2018 09:57:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48DC729F60 for ; Mon, 12 Nov 2018 09:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729409AbeKLTuA (ORCPT ); Mon, 12 Nov 2018 14:50:00 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:35828 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729380AbeKLTt7 (ORCPT ); Mon, 12 Nov 2018 14:49:59 -0500 Received: by mail-wm1-f66.google.com with SMTP id t15-v6so7517583wmt.0 for ; Mon, 12 Nov 2018 01:57:31 -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=ZntydDL3A95QZ0Q9bqPS7efY9/AnOcRfFMoWhJjuF9Gk55eXToWWO0MFVufb41xZUb nHLiTbmFBZG9+1cdt8aSYqRhhgzNW6mvo/J47vdQ+DPObGyWLAiX1dVnw6VnyGsWrHIX 7rTjNGD9VyfMoQr33985it7yVDU+01tI7ZnNQ= 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=n5l+PcJ/T7SlcwIYaO9Jc8/nNbbpIR/kgaRqoSEoIzLqcoBPVtJiWm8NaarJJ2EJ/e I+wKivDFvhPcaFj0VKMa0QomUoFa8JsPJjRfNkOFrxHDuwwWSqv06yG0cbGdDUWoZ5Ml 4nvzbOmgislZsXjSDt3rkuMFPSxzG/X7iQx1g68E4OG/Ek9zxa3/N1/QgwcG6vyVj3Ai RtVEyr48pwfPVV8vwMojro3oeaqlrzD1ntJxcKaJI7Tj0IiDmwHLudzQRNg3M/qeyESE w3lydgiaCoXrfGYjrruvB36qvx7M1dMUSIBjizpl1hC2Tt1iI0DJ7mExnv4IMALpftc6 e5dA== X-Gm-Message-State: AGRZ1gJKK9JK5mGOiJl11dFJs27xn5hEj0wKE7LDrrtq1pwl0qMZI+EJ ECF050MOwVYdVPmGBeenmIboug== X-Google-Smtp-Source: AJdET5eIJV6u6HegcE4uV2vFatX404HGAoD92vBcn00/LSxYXW6IXRwdLIzD2IsbIvSV20KQIm8j7w== X-Received: by 2002:a1c:3b06:: with SMTP id i6-v6mr6807918wma.18.1542016650265; Mon, 12 Nov 2018 01:57:30 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:29 -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 11/12] doc, bfq-iosched: fix a few clerical errors Date: Mon, 12 Nov 2018 10:56:31 +0100 Message-Id: <20181112095632.69114-12-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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 12 09:56:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 10678403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BFA1A14BA for ; Mon, 12 Nov 2018 09:57:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE94629F60 for ; Mon, 12 Nov 2018 09:57:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A23D329F62; Mon, 12 Nov 2018 09:57:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ACEA29F60 for ; Mon, 12 Nov 2018 09:57:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729428AbeKLTuD (ORCPT ); Mon, 12 Nov 2018 14:50:03 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40399 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729421AbeKLTuC (ORCPT ); Mon, 12 Nov 2018 14:50:02 -0500 Received: by mail-wm1-f67.google.com with SMTP id z8-v6so1321515wma.5 for ; Mon, 12 Nov 2018 01:57:33 -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=MpOWBJhYX62m+dv0e4xXNBLs0Dhr3TZXbDUpfWqj7Ic=; b=VFGD5aONmJPgDKVWuSsADhnuupo20davPrcXxMNwaQMZewp7EC2pNfPmhVeF7QXgpS akGJu9VK0L9wXDLo3UCtHJXHfph1HyHmjiXaGZ/dtlh85gW/caRxP0MJp6ZsuOqy8afm oR3leMzaETYNT3djwxxEJi91rWG0izRRGxgJ0= 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=MpOWBJhYX62m+dv0e4xXNBLs0Dhr3TZXbDUpfWqj7Ic=; b=EwKr+AUICM51LxetNI7gwPzylN/iyPeN9vvQgzotST3dkXgJMN9ZZPA55/ZTvJ18KJ //jmJTYLG9z0Ah20Lk2GC8tIKTN5i/c5Io5Sa8RwUjlTIJ6WLeIw7glxq9XQd8Fb82yF j/CpC7lJqpwNP8J0aK0hfwck+lFH7h8w9v6LH9pMxUll5n0mkrpK7EsZiAnYeRMpmozk ePJUl7IEXgTfP/AK6QaBN6n0t2MqDloEZJurThUa8zq9UeM2CU778EdRdOlQOSKpN7y/ pzZA3upfMFj8J3GiJx2JtiuNQeI+GW1eYV7m032nS0GmyCu3L2Q46AlaoLzEI7cI+EGU smHQ== X-Gm-Message-State: AGRZ1gLACWAKrXNHZ/CQ5Ew913N469O8nMOJTfZpdfH5x74BBEB5E3DQ 1kT8L2no0foT6wNrHzeJ6N5Ryg== X-Google-Smtp-Source: AJdET5fFs+lCHzRwboWRo84U8qMS4Iw1ZzFVDfw3E3P+yyuWPwOR1BS7Eetdc7j7kFYPiTHMWupTEg== X-Received: by 2002:a1c:111:: with SMTP id 17-v6mr1356272wmb.55.1542016652729; Mon, 12 Nov 2018 01:57:32 -0800 (PST) Received: from localhost.localdomain ([93.68.220.21]) by smtp.gmail.com with ESMTPSA id r14-v6sm21273089wro.8.2018.11.12.01.57.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Nov 2018 01:57:32 -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 12/12] doc, bfq-iosched: make it consistent with the new cgroup interface Date: Mon, 12 Nov 2018 10:56:32 +0100 Message-Id: <20181112095632.69114-13-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181112095632.69114-1-paolo.valente@linaro.org> References: <20181112095632.69114-1-paolo.valente@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Documentation/block/bfq-iosched.txt b/Documentation/block/bfq-iosched.txt index 6d7dd5ab8554..b1faf091266e 100644 --- a/Documentation/block/bfq-iosched.txt +++ b/Documentation/block/bfq-iosched.txt @@ -508,12 +508,11 @@ 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 shares interface files with CFQ. So, if one reads/writes a file +provided by the proportional share policy for a group, then the +associated operation is performed by/on BFQ for each device where BFQ +is the active scheduler, and by/on CFQ for each device where CFQ is +the active scheduler. 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 +520,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 +535,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.