Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1185917pxu; Sat, 5 Dec 2020 06:50:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOmfT0dPiqXKH9rW3N2KXg3pWj63AGhKdRBKDCCThD76JrIRhAhfaZ7EnhJ+W1dkyjr6+z X-Received: by 2002:a17:906:b1c8:: with SMTP id bv8mr11843667ejb.208.1607179834866; Sat, 05 Dec 2020 06:50:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607179834; cv=none; d=google.com; s=arc-20160816; b=acQgBhlL2RBb47aDQlbY6OMzmEZiDdIh5WEMdbwgSq3sDUfvNYboMlWOac6oiypiM3 L1epFXfdMjJuedHT50GYoC+auOxPVTBwffsDGM8QHaUu/3HoQCudZvjdME9YYh8BAJM3 HEoA1InwvJSn7uSb5C/0HEsEYaFc74/zFPJxHF6VfUSPTQsE3Hd/uop17Dv5aK2qeCje kRgF1W7PFA8oZ6rAJqwvqeh/e2MtZAICP+wQn5ShGbH5k1XtOgcWae5XTRAoESeszFTX goSEb+DumhWeaoHyvVtdTmiHq++yUeXiiM15EJfYIolRsR7ZZb4oOeU069JUvUh0CqIw Hfsg== 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 :mime-version:user-agent:date:message-id:subject:from:cc:to; bh=loMcZ+DWHueqSnlEtMus28BjWyC2oEKCQ4xFc4J1LQM=; b=J+eOEGjwYdJse4Xwfj1zOX8Pk1b8VhQMf7O9UJIClLiVQvCcc4fv+/Hsvg2i1C7m/h CTjJostJG8HcpiRR/HvNl40r29b1VQpoTjLcEtJcpSmzFtLkLu6Zq6m+2RuTdQAybaHP arYFZNWMf9TJpyrzafTiHaF+k0pdUECu2DwNyJvu7LEwQndl5olYHrf6F3prHhFzC8lt T6C9PDsGD+alZL/t0Lyf4wcE4Dmz65NnodQ7WaeiO6YAzJpG1BfhasBEjB+9IO65DB6S VHHj4LFmQ86YP0fxcRGh8VWIAtBJXU34wIeVwwyavXb6zoQ/Vg1C4piJPBENRas8O34i 2UrA== 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 c17si144781eds.556.2020.12.05.06.50.09; Sat, 05 Dec 2020 06:50:34 -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 S1726763AbgLEKLF (ORCPT + 99 others); Sat, 5 Dec 2020 05:11:05 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9016 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727302AbgLEKDn (ORCPT ); Sat, 5 Dec 2020 05:03:43 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Cp4My0V8QzhmgP; Sat, 5 Dec 2020 17:41:34 +0800 (CST) Received: from [10.174.176.199] (10.174.176.199) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Sat, 5 Dec 2020 17:41:52 +0800 To: , , , CC: Shiyuan Hu , Hewenliang From: Yunfeng Ye Subject: [PATCH] tick/nohz: Make the idle_exittime update correctly Message-ID: <2e194669-c074-069c-4fda-ad5bc313a611@huawei.com> Date: Sat, 5 Dec 2020 17:41:52 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 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