From nobody Mon Apr 6 06:11:41 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 385F6ECAAD3 for ; Fri, 9 Sep 2022 14:01:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229529AbiIIOBj (ORCPT ); Fri, 9 Sep 2022 10:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232022AbiIIOAe (ORCPT ); Fri, 9 Sep 2022 10:00:34 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28EF79411C; Fri, 9 Sep 2022 07:00:30 -0700 (PDT) Date: Fri, 09 Sep 2022 14:00:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1662732028; 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=XQYlL+/uPPur0eJBHooEGnxL1hR/WIyR0GHgF0y6biU=; b=P90C5OcyqH8APMj9x0I7lwpQojNcVm9KgtuQCjPbdctRduZvYL1DHyMGNkLLFcWaipuxdc QaBbIwC22ANPk9WH3iG754koEqO864xZW2MFIaZMCKx0+TsnsOV7vEKAbyOINfCXotSLBy USfpg9ZezJkn8ZXxEJR3WLw5D5/JHR0ohMyJ1IOhK3OmslKkJE7qdyOSZ4LX1IUefLyFOb 6DLmZwlDJgx/WkqDArmsOzXcRADMdtYQEPGjPkCKOgUM/QE8gX+2jzY25zE75dHn0XLbsV 84iw/g2hdq0DDM/PHU1RP7IPO+n5B/06A5vjFXvHmxJBCvLFr9kKEjsgcPl7yg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1662732028; 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=XQYlL+/uPPur0eJBHooEGnxL1hR/WIyR0GHgF0y6biU=; b=2GtzHEwhbPTjpRv6b3Qz5fLHe3NB5OQlOe/S9fgtZSVNeRUcTJR8RCJxUgB+zP8vygRm90 TxKXvBx75HWNZ1DA== 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] kernfs: Factor out kernfs_activate_one() Cc: Chengming Zhou , Tejun Heo , "Greg Kroah-Hartman" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220828050440.734579-8-tj@kernel.org> References: <20220828050440.734579-8-tj@kernel.org> MIME-Version: 1.0 Message-ID: <166273202752.401.7893730819537619208.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: f8eb145eb946d543e8c8df3d2db39fcd5c80dacb Gitweb: https://git.kernel.org/tip/f8eb145eb946d543e8c8df3d2db39fcd5= c80dacb Author: Tejun Heo AuthorDate: Sat, 27 Aug 2022 19:04:38 -10:00 Committer: Greg Kroah-Hartman CommitterDate: Thu, 01 Sep 2022 18:08:44 +02:00 kernfs: Factor out kernfs_activate_one() Factor out kernfs_activate_one() from kernfs_activate() and reorder operations so that KERNFS_ACTIVATED now simply indicates whether activation was attempted on the node ignoring whether activation took place. As the flag doesn't have a reader, the refactoring and reordering shouldn't cause any behavior difference. Tested-by: Chengming Zhou Reviewed-by: Chengming Zhou Signed-off-by: Tejun Heo Link: https://lore.kernel.org/r/20220828050440.734579-8-tj@kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/kernfs/dir.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index f8cbd05..c932395 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -1305,6 +1305,21 @@ static struct kernfs_node *kernfs_next_descendant_po= st(struct kernfs_node *pos, return pos->parent; } =20 +static void kernfs_activate_one(struct kernfs_node *kn) +{ + lockdep_assert_held_write(&kernfs_root(kn)->kernfs_rwsem); + + kn->flags |=3D KERNFS_ACTIVATED; + + if (kernfs_active(kn) || (kn->flags & KERNFS_REMOVING)) + return; + + WARN_ON_ONCE(kn->parent && RB_EMPTY_NODE(&kn->rb)); + WARN_ON_ONCE(atomic_read(&kn->active) !=3D KN_DEACTIVATED_BIAS); + + atomic_sub(KN_DEACTIVATED_BIAS, &kn->active); +} + /** * kernfs_activate - activate a node which started deactivated * @kn: kernfs_node whose subtree is to be activated @@ -1326,16 +1341,8 @@ void kernfs_activate(struct kernfs_node *kn) down_write(&root->kernfs_rwsem); =20 pos =3D NULL; - while ((pos =3D kernfs_next_descendant_post(pos, kn))) { - if (kernfs_active(pos) || (pos->flags & KERNFS_REMOVING)) - continue; - - WARN_ON_ONCE(pos->parent && RB_EMPTY_NODE(&pos->rb)); - WARN_ON_ONCE(atomic_read(&pos->active) !=3D KN_DEACTIVATED_BIAS); - - atomic_sub(KN_DEACTIVATED_BIAS, &pos->active); - pos->flags |=3D KERNFS_ACTIVATED; - } + while ((pos =3D kernfs_next_descendant_post(pos, kn))) + kernfs_activate_one(pos); =20 up_write(&root->kernfs_rwsem); }