Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1265867lqb; Thu, 30 May 2024 05:42:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWiEWEBNF12DzwBrPRfKMTB+Eteu6KLL3WMkDMsnStTRI6+D2iwwofpqeHEjsiE/N4Rgp0d5WuPuaH/cxoeO0vcK/MNBJ5OU2SxVUP3Dg== X-Google-Smtp-Source: AGHT+IG57yxw0G1XqzGUbWgERCNjpX6yenjNeYv0scv7WXJ1acjDiG+kfSmAfH3UGzw5ujVOjMPR X-Received: by 2002:a05:6102:1165:b0:47a:231a:3856 with SMTP id ada2fe7eead31-48bae9ba69cmr2063135137.16.1717072952690; Thu, 30 May 2024 05:42:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717072952; cv=pass; d=google.com; s=arc-20160816; b=K1fxcjavZebf4u8py33kY2iatRsV0Cg4dJZsVARf0WS26sp2lK9Z6UEWfGcPCbPUjo Kz2CYSzTK+1yCmtPioTdtRFeSg8yyZ0olYCgvR8UxsBv4BUyelzP0FQ5jCCiwu/oqcQk VmMs+BcjcUvxZlC7MQOSLgcgVCpP8b//fC6PzntuaxtkCxzbyQGeO/HsGfLhhsoJrnTw 9JfYwrD6EyN1Pou6FRAMzBfPi6sxwt+eJ25xR5RUTu4UZnuYdqxuqkkfSRWqWFGKbQbH /grd5/t/2zV5v2VPBBlpGRlew2WQLAT1sCu8EwexH/1duJnmNIJQc3y/zwotvUvmtvqq lrog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=KfFTRNobR6w6r7ulB7ciYohd23NT6TT29URqx7b26wE=; fh=DrnLVe9OaK7N4pqdHtGyBKWYB6W1LPA6jrokFQtXADY=; b=Nfk+uDr3tJifQUharh7EDhcY4SW8GIEW/q0TBMgolopJgxkgf10XhmWvmmnBun8UlU M/cT2TVSvygq1M1ZoKNhouHFl/DXnblnRjjbQtNFwfHkMDlTFZOkvs8OagqI7m3Qi/mA TnHPcwRaTYF5kclI4dXD0PXLtQpmEDX8WRpizLcmWRLzIDRn5L5+5Vx3E5yU5vluqL6X 1AIfK5H0Nh5tib+J1Nph01F28OIebZvBuz0aCA+IY3bYkc+OL8UIN9Y4M0RjgmizMVqS nMLwH5OT6A5M+xOxZJJN6i6WBeQffczApuxr7Rgs2pvLKjm3llvLwTT+XpWm6B8y49xq xJpA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b3KB5WVr; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-195376-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195376-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abd3d2b4si1479297385a.508.2024.05.30.05.42.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 05:42:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195376-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b3KB5WVr; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-195376-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195376-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 686351C22548 for ; Thu, 30 May 2024 12:42:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1181C132126; Thu, 30 May 2024 12:42:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="b3KB5WVr" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D2AD18309F for ; Thu, 30 May 2024 12:42:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717072946; cv=none; b=dA9bvSXcElUqSv0QUVtApBXGs72Biz/41v9NxyMQSpGlW3hYkT1xXmp7InllxROf8uDmAqj9jUnifEY6/xkE6g6PCRKb3j47mlpObJ2e95gCTIKAqEA2TZ4wpodT3tiPftRmeKfgbsBkR5T4GR+5Pnz8dkIQLuD/3nU/iLNvRAQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717072946; c=relaxed/simple; bh=UDq5p7N8hM9ghkOXmyXukJe2Fcsshv8WO2RUv36WPVA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B5ePolCXFBQpgRwonQGgedJXM82UFM6MmPuJ+53WsY5Z5F0om7BQJrO8wsmH8kJQIpcVvR/uiB7OFaegPoBSlMljwMf/P5qhb+HqEeHxaVV/OzzllCExGQFouiQAY+OB56hJOxglOcamxmJV2A90LjmP2KdR5/Af0eNEPPQLAtU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=b3KB5WVr; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717072943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KfFTRNobR6w6r7ulB7ciYohd23NT6TT29URqx7b26wE=; b=b3KB5WVreq7CNsty81IJgNKo4SZQ3xqIXj135SLkvgF7NweeDcVq55Xukn9ooVoqlvHkQW abmGbKOuMYcoico6HKNvdtrDpx3uG2eGAeORUhFLr8/QHwLzD/xSfgNrY2RjiOA8+vUxsr A3MbgDnA7nYKhkHNyaOJnNNu7RkR9jo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-340-8cajHHd6NdCJDfm7qoPCWg-1; Thu, 30 May 2024 08:42:21 -0400 X-MC-Unique: 8cajHHd6NdCJDfm7qoPCWg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 937898008A4; Thu, 30 May 2024 12:42:21 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.232]) by smtp.corp.redhat.com (Postfix) with SMTP id 97E66286E; Thu, 30 May 2024 12:42:19 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 30 May 2024 14:40:53 +0200 (CEST) Date: Thu, 30 May 2024 14:40:50 +0200 From: Oleg Nesterov To: Frederic Weisbecker , Ingo Molnar , Nicholas Piggin , Peter Zijlstra , Phil Auld , Thomas Gleixner Cc: Chris von Recklinghausen , linux-kernel@vger.kernel.org Subject: [PATCH] tick/nohz_full: turn tick_do_timer_boot_cpu into boot_cpu_is_nohz_full Message-ID: <20240530124032.GA26833@redhat.com> References: <20240522151742.GA10400@redhat.com> <20240528122019.GA28794@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240528122019.GA28794@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 We don't need to record the cpu number of the nohz_full boot CPU, a simple boolean is enough. We could even kill it along with #ifdef, the "else if" branch could check tick_nohz_full_cpu(tick_do_timer_cpu) && !tick_nohz_full_cpu(cpu). Signed-off-by: Oleg Nesterov --- kernel/time/tick-common.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 27d0018c8b05..9829a2cda072 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -49,15 +49,6 @@ ktime_t tick_next_period; * procedure also covers cpu hotplug. */ int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; -#ifdef CONFIG_NO_HZ_FULL -/* - * tick_do_timer_boot_cpu indicates the boot CPU temporarily owns - * tick_do_timer_cpu and it should be taken over by an eligible secondary - * when one comes online. - */ -static int tick_do_timer_boot_cpu __read_mostly = -1; -#endif - /* * Debugging: see timer_list.c */ @@ -178,9 +169,13 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast) } } +#ifdef CONFIG_NO_HZ_FULL /* - * Setup the tick device + * Iindicates that the boot CPU temporarily owns tick_do_timer_cpu. */ +static bool boot_cpu_is_nohz_full __read_mostly; +#endif + static void tick_setup_device(struct tick_device *td, struct clock_event_device *newdev, int cpu, const struct cpumask *cpumask) @@ -205,12 +200,9 @@ static void tick_setup_device(struct tick_device *td, * first housekeeping secondary will take do_timer() * from us. */ - if (tick_nohz_full_cpu(cpu)) - tick_do_timer_boot_cpu = cpu; - - } else if (tick_do_timer_boot_cpu != -1 && - !tick_nohz_full_cpu(cpu)) { - tick_do_timer_boot_cpu = -1; + boot_cpu_is_nohz_full = tick_nohz_full_cpu(cpu); + } else if (boot_cpu_is_nohz_full && !tick_nohz_full_cpu(cpu)) { + boot_cpu_is_nohz_full = false; /* * The boot CPU will stay in periodic (NOHZ disabled) * mode until clocksource_done_booting() called after -- 2.25.1.362.g51ebf55