Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2769027rwr; Sat, 6 May 2023 19:58:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4wncn3x3Kyd7f5ETL6/Jc43+ayOx99cf2AdoEBCjXPmjQXTyae/0woKl59BzRe3pUBzzXv X-Received: by 2002:a17:902:f9cd:b0:1a5:1e7:86d7 with SMTP id kz13-20020a170902f9cd00b001a501e786d7mr5729960plb.52.1683428287444; Sat, 06 May 2023 19:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683428287; cv=none; d=google.com; s=arc-20160816; b=iVLvFJeCWhnQABiZ4eNL/8FySiwfZ88yOd0Mitv1LCsP3KlQW+4XjEZanx9nVbU1Xg v5l5O9JOB3CSdiF+1OtQup4lRvStq5vjaYexIpZLs2t524jyTk6AXuT1+vf2bG/srynl aWo6TTjMq/aYMg2cJdVRD0/InUWNvjKdsOtaPwbCNX3jzJxlYGIMoKz4KGiJrEc+LAAh uMFQ+X1ljMRH3FQXUR0CCpqNJ4R/n10qBvTLEsDOqIcjMnrrhWO9pG6OgXjLmW89+Onq GwNHx4tUVSaesKKbpGAi1naB7Sjs8jJ8+SAjURRfnxL6+Ex1Gxc005ozfVdZXTnOALbC zcjg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=jQ4cSC7uFH60nvIGSlUaRgCiFTg6pgit2vHyGUvFgII=; b=bOtMjITOtuu1bQyGWK5C4kYOAYpapsWY3I1tJvHlD4XWI62c3isrod4YQU9F/UOMkR AGsq+US/Ca4chHfik9GbwRO6Uva2Kqln1xZ/+9IknLrXaFPiwlcfiErybYFXibTjWxR5 CDtRdQjQc4VNK8rwt9XbWzOwEq9Y8S/sKeOdKi0YXgPAvDsQnkgcL/h8PzdlQvtydl/k W99SmaqGDop/xACZOEbxdLCi4xMRJnSecH2roemYZLT4q/5iHd1yk/NkxuP3hRjC7sQH 5Atqs9O55QoHBPtmXiMdxefKVxTYfBdRlVzVxpkzakIOQdO6f2EfGCVJrJVHJzdxNRnv cKoA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bh2-20020a170902a98200b001a922c7f51dsi4791319plb.172.2023.05.06.19.57.46; Sat, 06 May 2023 19:58:07 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbjEGCEm (ORCPT + 99 others); Sat, 6 May 2023 22:04:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231178AbjEGCEk (ORCPT ); Sat, 6 May 2023 22:04:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E40AC1A112 for ; Sat, 6 May 2023 19:04:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 79D3E61254 for ; Sun, 7 May 2023 02:04:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80D7DC4339B; Sun, 7 May 2023 02:04:37 +0000 (UTC) Date: Sat, 6 May 2023 22:04:35 -0400 From: Steven Rostedt To: Li kunyu Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sched: core: Simplify init_sched_mm_cid() Message-ID: <20230506220435.0d7238c8@rorschach.local.home> In-Reply-To: <20230507023352.2784-1-kunyu@nfschina.com> References: <20230507023352.2784-1-kunyu@nfschina.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,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 Sun, 7 May 2023 10:33:52 +0800 Li kunyu wrote: > int mm_users variable definition move to variable usage location. Why? > > Signed-off-by: Li kunyu > --- > kernel/sched/core.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index f341e2100304..a66960da3f5c 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -11910,10 +11910,9 @@ static void task_mm_cid_work(struct callback_head *work) > void init_sched_mm_cid(struct task_struct *t) > { > struct mm_struct *mm = t->mm; > - int mm_users = 0; > > if (mm) { > - mm_users = atomic_read(&mm->mm_users); > + int mm_users = atomic_read(&mm->mm_users); This is not a requirement, and not everyone prefers this method. If anything, a real cleanup would simply be to remove the "= 0" and just have it be: int mm_users; As there's no reason to initialize it to zero. -- Steve > if (mm_users == 1) > mm->mm_cid_next_scan = jiffies + msecs_to_jiffies(MM_CID_SCAN_DELAY); > }