From nobody Wed Apr 8 12:59:54 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F509ECAAA1 for ; Fri, 9 Sep 2022 14:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232174AbiIIOB2 (ORCPT ); Fri, 9 Sep 2022 10:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232004AbiIIOAc (ORCPT ); Fri, 9 Sep 2022 10:00:32 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2D278A6FC; Fri, 9 Sep 2022 07:00:27 -0700 (PDT) Date: Fri, 09 Sep 2022 14:00:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1662732026; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jOuVbKQXTlZ31neaC6shUn0CS98gD3q+wAn9vPt2B9A=; b=bKAj3YzKZu5H2AXPvrGkLJUaN9HqzEVCm2e2WmhmFoYoTR8kU4rFfApFbTqVU8oNDTAvrl 8XV+iiMjfKpG8rxhzTegBVgrMxEcq0lsw50pgffVsHkbkbYf9CeRVp4Q9dpFeO1p1PmO0Z CwABrnSsNwieFX2uxsfQrT9KCj0S/nqcand+o2/Da+OuKXcwXSIJ7iCzEAcdnXdzPw74/M 8R8iz5f7I+3iHOTE9ku0JnRl3+lyfehld759F35idLBVqhJ7hQ+3d1mrA4TnFgna1fULiB dB6mbFTN6F002Lm3E7XLUEIlez8LymXNBdVGaAJO80r/zKz33eln/AUpGZYMzg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1662732026; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jOuVbKQXTlZ31neaC6shUn0CS98gD3q+wAn9vPt2B9A=; b=TtqP4IX5EoJ3R7SdoPlga84ZraDpZROu7rRUfI/OGjfOCY7HwP29ZVLXuntz49QdBQdBSa zJ9XRqixs+Q2lrDg== From: "tip-bot2 for Tejun Heo" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/psi] cgroup: Implement cgroup_file_show() Cc: Chengming Zhou , Johannes Weiner , Tejun Heo , "Greg Kroah-Hartman" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220828050440.734579-10-tj@kernel.org> References: <20220828050440.734579-10-tj@kernel.org> MIME-Version: 1.0 Message-ID: <166273202517.401.11532505009516572799.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/psi branch of tip: Commit-ID: e2691f6b44ed2135bfd005ad5fbabac4f433a7a1 Gitweb: https://git.kernel.org/tip/e2691f6b44ed2135bfd005ad5fbabac4f= 433a7a1 Author: Tejun Heo AuthorDate: Sat, 27 Aug 2022 19:04:40 -10:00 Committer: Greg Kroah-Hartman CommitterDate: Thu, 01 Sep 2022 18:08:44 +02:00 cgroup: Implement cgroup_file_show() Add cgroup_file_show() which allows toggling visibility of a cgroup file using the new kernfs_show(). This will be used to hide psi interface files on cgroups where it's disabled. Cc: Chengming Zhou Cc: Johannes Weiner Tested-by: Chengming Zhou Reviewed-by: Chengming Zhou Signed-off-by: Tejun Heo Link: https://lore.kernel.org/r/20220828050440.734579-10-tj@kernel.org Signed-off-by: Greg Kroah-Hartman --- include/linux/cgroup.h | 1 + kernel/cgroup/cgroup.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index ed53bfe..f61dd13 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -114,6 +114,7 @@ int cgroup_add_dfl_cftypes(struct cgroup_subsys *ss, st= ruct cftype *cfts); int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cft= s); int cgroup_rm_cftypes(struct cftype *cfts); void cgroup_file_notify(struct cgroup_file *cfile); +void cgroup_file_show(struct cgroup_file *cfile, bool show); =20 int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen); int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry); diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index ffaccd6..217469a 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -4340,6 +4340,26 @@ void cgroup_file_notify(struct cgroup_file *cfile) } =20 /** + * cgroup_file_show - show or hide a hidden cgroup file + * @cfile: target cgroup_file obtained by setting cftype->file_offset + * @show: whether to show or hide + */ +void cgroup_file_show(struct cgroup_file *cfile, bool show) +{ + struct kernfs_node *kn; + + spin_lock_irq(&cgroup_file_kn_lock); + kn =3D cfile->kn; + kernfs_get(kn); + spin_unlock_irq(&cgroup_file_kn_lock); + + if (kn) + kernfs_show(kn, show); + + kernfs_put(kn); +} + +/** * css_next_child - find the next child of a given css * @pos: the current position (%NULL to initiate traversal) * @parent: css whose children to walk