From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E2ABC63798 for ; Thu, 19 Nov 2020 09:55:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 078C7221FE for ; Thu, 19 Nov 2020 09:55:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="syJSbF0c"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NtCrZ7kg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727049AbgKSJzL (ORCPT ); Thu, 19 Nov 2020 04:55:11 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:60902 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726998AbgKSJzK (ORCPT ); Thu, 19 Nov 2020 04:55:10 -0500 Date: Thu, 19 Nov 2020 09:55:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1605779708; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wZUlvazKo7SUA8NIQ3s5W0oiDmaMb3Yh40+W+fnQCHU=; b=syJSbF0c6OWyE++vXHiDoz0xsxgC8rDoAN0K04K9DJvx4Q17/WlZRhYF5GHqU7DX+AUFk/ tDJaIlCSWKw4bcA8mrebkf86zjAa1Z0smskQngyGR1TQigWyWh4kHhCAUgZEJ11r2MHzsI vwHZwVLL+emciVTbfVi5qsePEO07xEX8OVTh5zOLeDqK2jfmld4yoBCLy7Pr/HZDgTsvf+ aVhLBPu6UxmAZ8yv3ZKuwEvRFy+nPvbbOukNvPZ3IySFZk7UYcLPIlxs/c2sU/gzE1tNpU bhGh74zB2nEXxumH4QNzXx9RpGzZPY+78IHLoWdMoLHLphwEicjJmGjaAXC1gA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1605779708; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wZUlvazKo7SUA8NIQ3s5W0oiDmaMb3Yh40+W+fnQCHU=; b=NtCrZ7kgBlOExckYmSIPJeSRyTObrcryD9MuKvB2CtgJ1BgiIvGbjU94x80KKNgazmHWmr 7I+nTOg9rwrhroBw== From: "tip-bot2 for Yunfeng Ye" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] tick/sched: Release seqcount before invoking calc_load_global() Cc: Yunfeng Ye , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20201117132006.660902274@linutronix.de> References: <20201117132006.660902274@linutronix.de> MIME-Version: 1.0 Message-ID: <160577970772.11244.568999884653345712.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the timers/core branch of tip: Commit-ID: 896b969e6732b68ee3c12ae4e1aeddf5db99bc46 Gitweb: https://git.kernel.org/tip/896b969e6732b68ee3c12ae4e1aeddf5db99bc46 Author: Yunfeng Ye AuthorDate: Tue, 17 Nov 2020 14:19:48 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 19 Nov 2020 10:48:29 +01:00 tick/sched: Release seqcount before invoking calc_load_global() calc_load_global() does not need the sequence count protection. [ tglx: Split it up properly and added comments ] Signed-off-by: Yunfeng Ye Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20201117132006.660902274@linutronix.de --- kernel/time/tick-sched.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 306adeb..33c897b 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -107,7 +108,8 @@ static void tick_do_update_jiffies64(ktime_t now) tick_period); } - do_timer(ticks); + /* Advance jiffies to complete the jiffies_seq protected job */ + jiffies_64 += ticks; /* * Keep the tick_next_period variable up to date. WRITE_ONCE() @@ -116,7 +118,15 @@ static void tick_do_update_jiffies64(ktime_t now) WRITE_ONCE(tick_next_period, ktime_add(last_jiffies_update, tick_period)); + /* + * Release the sequence count. calc_global_load() below is not + * protected by it, but jiffies_lock needs to be held to prevent + * concurrent invocations. + */ write_seqcount_end(&jiffies_seq); + + calc_global_load(); + raw_spin_unlock(&jiffies_lock); update_wall_time(); }