Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp141296iob; Tue, 17 May 2022 21:38:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuKbj+xPG/Xv2zX8h6Tliekp+Vk4jrbPGwDR8bG29dlBCb524SvS7ZjvdytM96qCVnHflf X-Received: by 2002:a17:90b:1a8c:b0:1dc:1c62:2c0c with SMTP id ng12-20020a17090b1a8c00b001dc1c622c0cmr39897082pjb.140.1652848703389; Tue, 17 May 2022 21:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652848703; cv=none; d=google.com; s=arc-20160816; b=xMntF/3vYRZXe8RC4qbbPfx5/WnJcYO6oMaxUJYGt/cNN/xLYub9dONEFma8KQy4hn kkfzefe0znBouOANZmL+EBaLBmXOaZxSzApJ0wgVpROL+mpiuojXQ1+5Skq7ZT6mwOQ1 ApPEsmgpJhceoyiGCi7+uRgHIRvAuoZ6NLOSCuIkFFvUqj5b6rZT/P7GJN4Ynww/tnye Nnhc0ysDTYaReyT7ykP43M8wbaCL3dKoagdwDcfgBinAmMa1hGOwRT7aWmPSzEEVMlI4 aWzUdfIXjSRQyouvwf7nO3et/TaZ75od5XmuS0cokdg30IOSe0zWJ2SoWMwI52q4AHHG sKMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=xx6rePJGi7UaKhXkXrJAOBEtEBFBD4Xp8h1aCNNQ5pk=; b=qKU851JN69yplx+eITv2knstMGoK1fo0QSmn6tVrCCFPAsj2tbLnbYT/pvs2HH4KqB SpiSW5Gef0XMl+seDT0CWsn7CxzjqEr5C05eB6P5YlDBXTXelYhb8nMP14I3CE5JCln+ 7W/IfGK9w9gJZzAYxAm4nNzH6rIB9VvH4Lzm7uLLnbnwPaM5U5Rj/tHjavtI0mnCmtmr hX0Oeg5J5CWPdjdBrBSYe4c/LENyW53b8wNO+Yttq7w/9L6Kpyhcz0pFdWXsC/m94YBX V/uMHNAAEJbCznuibiZ7+Se/RrbDn4f2Ynk/cnI9Z13aw9yqJy7LOAMgwlyYlHjYXpNq qgyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UQsNDu+K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 189-20020a6300c6000000b003f278fc0e7csi1180498pga.813.2022.05.17.21.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 21:38:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UQsNDu+K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1C361D682B; Tue, 17 May 2022 20:55:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233690AbiERBhu (ORCPT + 99 others); Tue, 17 May 2022 21:37:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbiERBhs (ORCPT ); Tue, 17 May 2022 21:37:48 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E94E531340; Tue, 17 May 2022 18:37:47 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id w17-20020a17090a529100b001db302efed6so568464pjh.4; Tue, 17 May 2022 18:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xx6rePJGi7UaKhXkXrJAOBEtEBFBD4Xp8h1aCNNQ5pk=; b=UQsNDu+K3TL0RoWiqYU8aJzPlG4KoKs+NqzgTjzA9gmgB35p+OeNfvgvxiT+Otn5ux jI5s5WqirBU7Jhbz2L+2B+EJXfZ2e4Cs3jAZ/A0cQMHaqEnA96dxbK2nCn7UlGNwaamT vImHt36Kj+bSNIwtjD+WJcqbXUskciCiPM1BbywHDZQvN8JxmTzU2MFyqB3E1OqyDLPZ vO8A3/HfT0FQ0B2vxv1qWYmZKph3LyIe5s/jDZcMgrwyx4sty97N81e32k6rigUqWKIh CeBuaUr31rQy/LHnS/aJHG3hlw7k5cwRtGBd4X70mYiDYzbWzv3/zupNOkklKPlQW7CU Cu/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xx6rePJGi7UaKhXkXrJAOBEtEBFBD4Xp8h1aCNNQ5pk=; b=QNrypGJioS2wh1rQyD/XJJ7IyZk6OEy2imJo+dhDHvDMAJBxGli1tJ4mopcFxOGsdz k3FANd7i6pOuSJKrU+E1FnYwuGGRmYA2nvu5wB6d3fMvz7Ob3z3aM1sZV170ietiJXAd EO4gOcN90sPWAl5YHAI9g2KLQxNzG+QPVKOnZHV+8C/FlZn4Ej5Zo73wai5tUiIs5iTE kjCBAIcoSqZUE8Zpg6/nkEkUclBC6OU3DS8oGEQmQog51G0hlpjk3lamQ0LWXnTzUDeV BKBqL0/tMzRFQBe3xQUF3fS8jR45qOW+arVyFIidcLG+Ii5nvhNqaC450dYA7kkjSBAD CKPg== X-Gm-Message-State: AOAM532rEpfPac5CNgyEXuuXJzxQUiOXWuxZsFV8PuLfG44NP5PY5sSI vOWPejxX1IryvCJHXK47S0I= X-Received: by 2002:a17:90a:c48:b0:1df:6210:48a0 with SMTP id u8-20020a17090a0c4800b001df621048a0mr12119030pje.119.1652837867447; Tue, 17 May 2022 18:37:47 -0700 (PDT) Received: from localhost.localdomain ([103.197.71.140]) by smtp.gmail.com with ESMTPSA id u191-20020a6385c8000000b003c14af50627sm200052pgd.63.2022.05.17.18.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 18:37:46 -0700 (PDT) From: Shida Zhang X-Google-Original-From: Shida Zhang To: tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org Cc: zhangshida@kylinos.cn, starzhangzsd@gmail.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: [PATCH v2] cgroup: remove the superfluous judgment Date: Wed, 18 May 2022 09:36:47 +0800 Message-Id: <20220518013647.1749568-1-zhangshida@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the superfluous judgment since the function is never called for a root cgroup, as suggested by Tejun. Suggested-by: Tejun Heo Signed-off-by: Shida Zhang --- Changes from v1: - Just remove the superfluous judgment instead. kernel/cgroup/cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index adb820e98f24..7d8a463c461b 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -5685,7 +5685,7 @@ static int cgroup_destroy_locked(struct cgroup *cgrp) css_clear_dir(&cgrp->self); kernfs_remove(cgrp->kn); - if (parent && cgroup_is_threaded(cgrp)) + if (cgroup_is_threaded(cgrp)) parent->nr_threaded_children--; spin_lock_irq(&css_set_lock); -- 2.25.1