Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp8705187rwd; Tue, 20 Jun 2023 20:03:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4pHIbbanb9U3EwLBrQCXbTLERYPxxAn7YezrS+FdeKRxnpDSfhSHzxBYDs+0zhe7phH3+b X-Received: by 2002:a05:6a21:339b:b0:122:1fc:38b8 with SMTP id yy27-20020a056a21339b00b0012201fc38b8mr5724660pzb.48.1687316638338; Tue, 20 Jun 2023 20:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687316638; cv=none; d=google.com; s=arc-20160816; b=GxR+FUOwM2vSwMuYZvDaD5zIHb3mD+WWFG33qCtLfBEXlHHkBHQ/bIDO+ggtZD1SOc WPm5ifY0zcYIPxwcbA7CCT+z8AM8xcSC1aPnM5P7uz+inXihRfVXVOf8AM+o9vuXdr9n ePSy6W1/Sfyq2ezx+MyRFb7gK5bUmt6ifmMFTPXVxqzCb8O8yQPvYI/wbnipM0Nin9CS psJe5/o7Etu2MWRgF4Z8tYuhbStHyznOWyBvnj93I/WbvT8+M5v8BVM8C2ckIPO70LXP DTb/IPW8bZ0yJEK0cb4+u9l28HJ+8kxsQI3sHbzJbA41k8wqbue19lyILMx0B9QA5lJi 96+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=8ugoa1gE+RbszeXsDIW/+r8VHMmZ8ve2zoc+qy7vZ84=; b=rpFKWBQUsV5+0vZLnJO+CJPZ0M5aqM1mceCrlZKaf68GFmHpkRRHKapfx1jWwqOAsf m1BoN9nRnT6HzOsBua7g8NLtdhIM2pbBvxs8efPxswsokITN2O0/pIiWa6aA/OSsbRB/ 01TUDRtknxco7cQSttbdFQ+Dagh8HQwSlGju9NuEZZN90ca3BkNORgzP3jXSHy9gpGLL 0uiBdQPNE/0L2DHAR7/9OaC/+jZEURV1aCtCQZDx4avIs2q5ilx60qUtGv+NxQYA6tx+ zpGnvS+PLDlHWjEdG/n71xpMl88VvvMWngCO01I9OnVyHNM4wU5DMXJveOrni+w2K6Td 2tSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020a170902c40500b001a677821130si3790352plk.13.2023.06.20.20.03.46; Tue, 20 Jun 2023 20:03:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbjFUCyC (ORCPT + 99 others); Tue, 20 Jun 2023 22:54:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjFUCyB (ORCPT ); Tue, 20 Jun 2023 22:54:01 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E03A1B4 for ; Tue, 20 Jun 2023 19:54:00 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Qm7PC3Tj0z1FDhg; Wed, 21 Jun 2023 10:53:51 +0800 (CST) Received: from [10.174.151.185] (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 21 Jun 2023 10:53:57 +0800 Subject: Re: [PATCH] sched/topology: remove unneeded do while loop in cpu_attach_domain() To: Peter Zijlstra CC: , , , , , , , , , References: <20230617081926.2035113-1-linmiaohe@huawei.com> <20230620141120.GA2016469@hirez.programming.kicks-ass.net> From: Miaohe Lin Message-ID: <53a9ec35-8332-755c-40ed-54315ffb0d78@huawei.com> Date: Wed, 21 Jun 2023 10:53:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20230620141120.GA2016469@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 2023/6/20 22:11, Peter Zijlstra wrote: > On Sat, Jun 17, 2023 at 04:19:26PM +0800, Miaohe Lin wrote: >> When sg != sd->groups, the do while loop would cause deadloop here. But >> that won't occur because sg is always equal to sd->groups now. Remove >> this unneeded do while loop. > > This Changelog makes no sense to me.. Yes, as is the do {} while loop is > dead code, but it *should* have read like: > > do { > sg->flags = 0; > sg = sg->next; > } while (sg != sd->groups); > > as I noted here: > > https://lore.kernel.org/all/20230523105935.GN83892@hirez.programming.kicks-ass.net/T/#u [1] > > So what this changelog should argue is how there cannot be multiple > groups here -- or if there can be, add the missing iteration. [1] said: " Yes, I missed that. That being said, the only reason for sd to be degenerate is that there is only 1 group. Otherwise we will keep it and degenerate parents instead " IOW, "sg = sg->next;" is missed intentionally in the do while{} loop to show that there's only 1 sched group. This looks weird to me but no persist on change the code. Thanks.