Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2873517rdh; Wed, 27 Sep 2023 15:58:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSiUfr9YUKZWWqp5aMxjHLEwECPWbR/xI3t5SdVuzKKF7luow+bzUJFKJEKKDLgSnGBvdn X-Received: by 2002:a05:6402:1841:b0:52b:d169:b373 with SMTP id v1-20020a056402184100b0052bd169b373mr3250517edy.32.1695855485295; Wed, 27 Sep 2023 15:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695855485; cv=none; d=google.com; s=arc-20160816; b=F8IJUHGGvtA+MoGMy8++bOauDwS3jsERiLO/zuMANiJ0Gzgw4D48Du8vAryQCte7Wj EKBuimrVdh+3AOT4L/lppDq5tupqI4LeGwqBJIugDOYNXvF5YbL9RXjfd9gCr0vFV5Nm 9l5/vd6PQo997BIh5hki6j8DemOKKT1PI8gsqDGM644AyP2/x1bjQKGU3oYYuwn/y6EV Y7nxuveQ9rE6Nf9RoJ9KvIN7VRpCz8kLBU3JlygFBwblOJcq+Ikrjb+47tFfoPSUgJVh A/FH3uGJmir1DUrJU9wdnPld57PvuyEIuhn/Q0EQzgE24VIUfLb5dn4B2TJaiGEigLTC JfVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2otPEB/xF2y2gWB3F3HzuUrVDzeh6ktV3K7Sy+EklX0=; fh=GhgNu/9f9lNuBBPKk8oPDgRbzfq/FTKNGZPxHPjr2n0=; b=VJijB8Y8C/qojRTkN//vao4t89JMq6926BWND7yM2iTRMJ0oK1wKlOkmG9PIu+q/E2 3GqOfvEliDyQ2HofAZn3Ymz09nBe5Blf90HwJCcJ/nr79+7OTsK+6DQHSB4S6SQYVBQF gX+b03q9uLxLx0NYHhj5PU0kzhGC1E4VUVsmKVARfCJ0PBtl7AB+6tPtkEIjaFM6N2x1 wlfavvdTqsj77Ej4i+QjGCgijBC/MsWcLsPN0Q4bFkRseoNXuhOILm5Fzf3actpgKhiB x+8geK4LIwlj6SgGUxSuxv6hv8FIVTX9e+Ca4WX9IpL3/E/X8oKlJlWtbNrxAnJFuow1 5W2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EbmpA7qT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u10-20020aa7d88a000000b005342ec1e69fsi6345212edq.157.2023.09.27.15.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 15:58:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EbmpA7qT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 67E9F804C1BD; Wed, 27 Sep 2023 01:55:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbjI0IzY (ORCPT + 99 others); Wed, 27 Sep 2023 04:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbjI0IzV (ORCPT ); Wed, 27 Sep 2023 04:55:21 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51759D6 for ; Wed, 27 Sep 2023 01:55:20 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-27736c2a731so5968962a91.3 for ; Wed, 27 Sep 2023 01:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695804920; x=1696409720; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=2otPEB/xF2y2gWB3F3HzuUrVDzeh6ktV3K7Sy+EklX0=; b=EbmpA7qT9M07ebVuaPitNjzgcOedRb9DydqODUjph9L9OPUcAwRfTGDOcewdYuszZT TbBmw0tdaA/anFCxTZnHd2j2mOkpxzKXE5/lUqcNeOzOr15iXYpNxTx1ziHSmwBccRCO ZUItyftG46X8ffNRQfy3OcB85aEXXMWXbPWv2YwISp61vO0gaG8M6GZtvSYMThlqRVVK J4tJP3Te8pOFWXISLDXSFHgZIJFctPONCdEZHjJ2pw2mFxuChBBR/IqT2yTYFvDqNB78 Lto0LYTHYL6ivRQzepkILBW9y2gZYVUCmBGfqWNxmrLgiVtRqDhKQ9Iaj2qCaP3Tip/6 6fbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695804920; x=1696409720; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2otPEB/xF2y2gWB3F3HzuUrVDzeh6ktV3K7Sy+EklX0=; b=GXaIQgplsUsbHzIiWPK89IXUc+/fzEPGOUpBa2nF6bc5fAPXZGijZXMz91x9Q1+Qyj 535/QZpqSp3wQKg2AWr6GwtFzU83AOzSh1pW73Z/z1Vc3v0YWuVSaIILe93W5+9YLfBR j8ircnwttirCvgeyfLLg6GqWuLh8Ch//h/QjJwfFilU824fYdMOSAo+c43542+p8Rs05 rdteQ9SGig+4YgrxO4jLabj7l8rZja55EzPGew4kji//jewhgz2y/7hUg6bpagZFGLWN QclP9hnw8Go/OkNe4Il4pTUTOtFlKIEK54sOcAMOoq+Flk27yrdSZ63MhHZL6zydP8MK OYuw== X-Gm-Message-State: AOJu0Yz3SB2BySSZ/A3xG2XTCmuZ0OUcpwoRShjTeDnMza4OTeaxfU3s QRjV4E77wMDkw/ZNQ8hQ5RB4IA== X-Received: by 2002:a17:90b:4d89:b0:274:bf7a:60cd with SMTP id oj9-20020a17090b4d8900b00274bf7a60cdmr1143971pjb.34.1695804919803; Wed, 27 Sep 2023 01:55:19 -0700 (PDT) Received: from localhost ([122.172.81.92]) by smtp.gmail.com with ESMTPSA id lj8-20020a17090b344800b0026b4decfe59sm11424070pjb.31.2023.09.27.01.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 01:55:19 -0700 (PDT) Date: Wed, 27 Sep 2023 14:25:17 +0530 From: Viresh Kumar To: Liao Chang Cc: rafael@kernel.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpufreq: schedutil: Merge initialization code of sg_cpu in single loop Message-ID: <20230927085517.udfg3udsqkmrugj2@vireshk-i7> References: <20230908031604.2262422-1-liaochang1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230908031604.2262422-1-liaochang1@huawei.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 27 Sep 2023 01:55:43 -0700 (PDT) On 08-09-23, 03:16, Liao Chang wrote: > The initialization code of the per-cpu sg_cpu struct is currently split > into two for-loop blocks. This can be simplified by merging the two > blocks into a single loop. This will make the code more maintainable. > > Signed-off-by: Liao Chang > --- > kernel/sched/cpufreq_schedutil.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c > index 4492608b7d7f..f3a95def49cc 100644 > --- a/kernel/sched/cpufreq_schedutil.c > +++ b/kernel/sched/cpufreq_schedutil.c > @@ -767,14 +767,6 @@ static int sugov_start(struct cpufreq_policy *policy) > > sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS); > > - for_each_cpu(cpu, policy->cpus) { > - struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu); > - > - memset(sg_cpu, 0, sizeof(*sg_cpu)); > - sg_cpu->cpu = cpu; > - sg_cpu->sg_policy = sg_policy; > - } > - > if (policy_is_shared(policy)) > uu = sugov_update_shared; > else if (policy->fast_switch_enabled && cpufreq_driver_has_adjust_perf()) > @@ -785,6 +777,9 @@ static int sugov_start(struct cpufreq_policy *policy) > for_each_cpu(cpu, policy->cpus) { > struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu); > > + memset(sg_cpu, 0, sizeof(*sg_cpu)); > + sg_cpu->cpu = cpu; > + sg_cpu->sg_policy = sg_policy; > cpufreq_add_update_util_hook(cpu, &sg_cpu->update_util, uu); > } > return 0; Acked-by: Viresh Kumar -- viresh