Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3313731pxu; Tue, 15 Dec 2020 04:10:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8nwx3oCpyF4XS/ts1A27Yul0N6V2L8TeNjUHlZkzk9gKl0jMOKZ47vY4GCvB1ODWj5RH5 X-Received: by 2002:aa7:dbca:: with SMTP id v10mr13447175edt.219.1608034247666; Tue, 15 Dec 2020 04:10:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608034247; cv=none; d=google.com; s=arc-20160816; b=ttyaDKqMj+Jb+ifIHxlL2CLzoNKUTX5iEmsVoQgkLuaE+RAujCWwaiPjeXGLO1n5UW GMeGd6c32zcuxRZeTT++kHPqYDqjURtXAmUP6xYFhna6mUL/b3FGMYahJwi2lx7ik5IC 7sp2b7ZERijenwC4SPS5CrJPCEg7gC9hsCoaT6sWJYXVN9KVs5fqyc6m8+A1ageu6HJ/ qLTgDWWm3YvpC4LnwkJhWVVQNlyMJiAjOie4EJmAMZfj6o0mbd04TRpiAJVHFj9M/ENE bhVEfzsz6lNyhQUbflqncGkfd2TaUC8xd6mo9EGoSyL/1AKDV9ADGzyqC2m4Gda/1nHH fUEQ== 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:references:cc :to:from:subject; bh=loMcZ+DWHueqSnlEtMus28BjWyC2oEKCQ4xFc4J1LQM=; b=kruYITtw6zu14ZhGHjhrcIqY/PMiYfSrvaaQ7gsZhl7BzTo2SfsiIds7wRBaPNCPUg NaSekyjsvAsPZyPzymnX+5+J4/G/cNX3TaF6RjBGiIZ3leQCirBOP7fqq/K4OVffILo3 39gI1xMSdNgpmH5nEX19tgCfw3sLrp2lwwvqjngh4N4XrHGQNN5n00TIPTRp3e/83EOH 1EPHPEXFGPvFiGKQ4gs77+YYUqFCbY7+HFXzaGI20tlP7qNlDk9WL5Hhc5+U/1TfNLfF siusJwHnRlU73CA173OQS70+pASLUjQZZ2Gu2TBZOtuE7l5ayWkHVLGI8hQl23LuV13o znSg== 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 h14si887011eje.325.2020.12.15.04.10.24; Tue, 15 Dec 2020 04:10:47 -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 S1729026AbgLOMHj (ORCPT + 99 others); Tue, 15 Dec 2020 07:07:39 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9531 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727282AbgLOMHi (ORCPT ); Tue, 15 Dec 2020 07:07:38 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CwH6L6hsYzhs8G; Tue, 15 Dec 2020 20:06:18 +0800 (CST) Received: from [10.174.176.199] (10.174.176.199) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Tue, 15 Dec 2020 20:06:46 +0800 Subject: [PATCH] tick/nohz: Make the idle_exittime update correctly From: Yunfeng Ye To: , , , CC: Shiyuan Hu , Hewenliang References: <2e194669-c074-069c-4fda-ad5bc313a611@huawei.com> Message-ID: Date: Tue, 15 Dec 2020 20:06:34 +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: <2e194669-c074-069c-4fda-ad5bc313a611@huawei.com> 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 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; 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