Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1005831pxu; Wed, 16 Dec 2020 22:55:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqPcTs8xRTrzaCz6y66dWoHNH69I7LeBR2tV14AK8OtW4mV5muWEoww6FC2AXc+72quaCc X-Received: by 2002:a05:6402:2da:: with SMTP id b26mr37392137edx.350.1608188111258; Wed, 16 Dec 2020 22:55:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608188111; cv=none; d=google.com; s=arc-20160816; b=ntqnB5HiPtYtuVxFrAO9R1Zb/bUK0NP9r5XtGW1L/YjNithwj8b2T90QG0LqZbl1O8 nJl7sQKP0dxO2EfpPwc7kkgI0nmk0fOz9f2SqvfTxaeLZkMO6hU9kGGKjwJHC1jN0twe 1cH86jt9KUatxBTP6pzXeKqPUDFrkUEtteAAOSAVYWalbd1OtzQf6JUv2rk4WBbvT7Y5 NiseR/VPCVf4IzZB5CNhHDlpnu0C7lR3Mg1YZCAhrL2r+hk09mRw/u4YtT0vmBbmg6s0 0RmyxiFx+VnZ3etavqN96jRCRMZGB2WqAdPF2S8TE7MjX0zoPkZd9PBGmcCF9fUI+5PJ wx2w== 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=SPrFnV3N4gd9USgsLg4qHFF0oFFxL7z5GayLoRebkNY=; b=JCNaeLVJ0e5dlt4e1z/ahtMwRt4EaNWgnQmkGbKapOPxgx8el3LAdyBcu2p9j5Lj+6 sYuuuCTGAzcc8h0WqJElq8o0xog0TmitPPWOXqAEYnSoDhdO4XfnwBHqGUQQesU1yM+y Ts6H66JELM0UZMsAP5juQ9nlefYdLN520B44A6s3tqOKVDaqrCwgu6/3aVAqcgqVvrwS ZlL/AOW4tPCOJwvfH893lhPCKc2NFhfydvT1SbgDADHfBhylxEL74HIQTyOuND/7ghA6 hrV4iz03wzdh+9Y6x4h5bGSjjxMUDcpStJp/+b/IefqbHMAH5GZWTyTiUz8pPNJ3wQ2V Ldgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx8si2158246ejb.559.2020.12.16.22.54.48; Wed, 16 Dec 2020 22:55:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727352AbgLQGxC (ORCPT + 99 others); Thu, 17 Dec 2020 01:53:02 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9628 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726569AbgLQGxB (ORCPT ); Thu, 17 Dec 2020 01:53:01 -0500 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CxN2M5Ghnz15YMZ; Thu, 17 Dec 2020 14:51:39 +0800 (CST) Received: from [10.174.176.199] (10.174.176.199) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.498.0; Thu, 17 Dec 2020 14:52:10 +0800 Subject: Re: [PATCH] tick/nohz: Make the idle_exittime update correctly To: Frederic Weisbecker CC: , , , , Shiyuan Hu , Hewenliang References: <2e194669-c074-069c-4fda-ad5bc313a611@huawei.com> <20201215144757.GA9391@lothringen> From: Yunfeng Ye Message-ID: Date: Thu, 17 Dec 2020 14:51:58 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20201215144757.GA9391@lothringen> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.199] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/12/15 22:47, Frederic Weisbecker wrote: > On Tue, Dec 15, 2020 at 08:06:34PM +0800, Yunfeng Ye wrote: >> The idle_exittime field of tick_sched is used to record the time when >> the idle state was left. but currently the idle_exittime is updated in >> the function tick_nohz_restart_sched_tick(), which is not always in idle >> state when nohz_full is configured. >> >> tick_irq_exit >> tick_nohz_irq_exit >> tick_nohz_full_update_tick >> tick_nohz_restart_sched_tick >> ts->idle_exittime = now; >> >> So move to tick_nohz_stop_idle() to make the idle_exittime update >> correctly. >> >> Signed-off-by: Yunfeng Ye >> --- >> kernel/time/tick-sched.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c >> index 749ec2a583de..be2e5d772d50 100644 >> --- a/kernel/time/tick-sched.c >> +++ b/kernel/time/tick-sched.c >> @@ -591,6 +591,7 @@ static void tick_nohz_stop_idle(struct tick_sched *ts, ktime_t now) >> { >> update_ts_time_stats(smp_processor_id(), ts, now, NULL); >> ts->idle_active = 0; >> + ts->idle_exittime = now; > > This changes a bit the meaning of idle_exittime then since this is also called > from idle interrupt entry. > > __tick_nohz_idle_restart_tick() would be a better place. > So is it necessary to modify the comment "@idle_exittime: Time when the idle state was left" ? On the other hand, if the patch "nohz: Update tick instead of restarting tick in tick_nohz_idle_exit()" (https://www.spinics.net/lists/kernel/msg3747039.html ) applied, __tick_nohz_idle_restart_tick will not be called always, So is it put here also a better place? Thanks. > Thanks. > >> >> sched_clock_idle_wakeup_event(); >> } >> @@ -901,7 +902,6 @@ static void tick_nohz_restart_sched_tick(struct tick_sched *ts, ktime_t now) >> * Cancel the scheduled timer and restore the tick >> */ >> ts->tick_stopped = 0; >> - ts->idle_exittime = now; >> >> tick_nohz_restart(ts, now); >> } >> -- >> 2.18.4 >> > . >