Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp882414rdd; Wed, 10 Jan 2024 02:20:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGn8D2vgLQrSWZrV/feNsIuaq59NMQ6zF7lb6aGypuWKCJ+j3XHdFbpsyFjmU5AwOraA5v6 X-Received: by 2002:a05:6214:5281:b0:67f:ad04:871f with SMTP id kj1-20020a056214528100b0067fad04871fmr933906qvb.114.1704882042455; Wed, 10 Jan 2024 02:20:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704882042; cv=none; d=google.com; s=arc-20160816; b=rokmYwUKKAv2nhIBuVtjoijPjjLvMGdXH529NY72KsbRoLCyIUeuLPEi9XxWuooKmd sZVDryFsnsu+PTtetz+bLIJonqtQsAOJTf0+Ubvuxz8aRpVCWUnJx7ZAPCTbwe+QPLwt +b0gS/GloRyKJ/3k4pFCHI6U5Bf3ZQD3J0sVWEiL3C5xkqlMZiq6K8j3x125POmDVHVz Yt4i8cC5gKC3b/QZrCT9gSFk8V57SoT8Pa1AMxuNXZhkrbzkCXGEu4N/OdxInD4I7fa/ YhSibOJTbbrTndqSOFskS73t079fZiOtLqJbAAv1h6Ow053mXU6AfnYGw+K6vMhNftc1 WpqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=wZUdrE/hq0Ov54U749lA6OtUMWpAlT6/RSvpU7mhg/o=; fh=cKnnuKiI26Y2XZcDrYu6F5PemUXVxu6KF717xnjNoRc=; b=mAEV/X8F/Sj4FmP6m0KHxW/UChcJaAZ0Ulymb8pgfXzL78t5NcT003R5qq/L8USyeh z+OAeORkiQu8b/wU4SQmgtwq66zhwCtk5g8Qwcdsl+rD+9dw+DJeZY735jTRcrPygnJX mQWUTXPASMra8TSRej8RXYr9mV5XwhVSIJv0Gd1U3OCjg1LIjGKC1W+pfhwdW5bbCi+5 qjyO+BqJ3fuAuWhaFcMR0nhO+CfbHnWfSMPE9RunJCxG0RHtJxgWKRuknYYvSRicyLfX WoX0ktQLN+M44ORiC4ev3X5ESxEtNKdVC4tSRIx/3EY99qf4w6BzyUknbs0k8Povq5JP nOLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-21962-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21962-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q3-20020a0cf5c3000000b0067f8c1fcfb4si4195783qvm.166.2024.01.10.02.20.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 02:20:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21962-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-21962-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21962-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 5A8831C2643B for ; Wed, 10 Jan 2024 10:20:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E56953FB1C; Wed, 10 Jan 2024 10:20:12 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90CB63FB02 for ; Wed, 10 Jan 2024 10:20:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3D0302F4; Wed, 10 Jan 2024 02:20:54 -0800 (PST) Received: from [10.34.100.129] (e126645.nice.arm.com [10.34.100.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D3EE93F73F; Wed, 10 Jan 2024 02:20:06 -0800 (PST) Message-ID: <06a2561f-557b-4eaa-8f11-75883bbbaef9@arm.com> Date: Wed, 10 Jan 2024 11:20:01 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] sched/idle: Prevent stopping the tick when there is no cpuidle driver To: Anna-Maria Behnsen , linux-kernel@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Thomas Gleixner References: <20231215130501.24542-1-anna-maria@linutronix.de> <87ttnmiif9.fsf@somnus> Content-Language: en-US From: Pierre Gondois In-Reply-To: <87ttnmiif9.fsf@somnus> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hello Anna-Maria, On 1/9/24 17:24, Anna-Maria Behnsen wrote: > Hello Pierre, > > Pierre Gondois writes: > >> Hello Anna-Maria, >> >> On 12/15/23 14:05, Anna-Maria Behnsen wrote: >>> When there is no cpuidle driver, the system tries to stop the tick even if >>> the system is fully loaded. But stopping the tick is not for free and it >>> decreases performance on a fully loaded system. As there is no (cpuidle) >>> framework which brings CPU in a power saving state when nothing needs to be >>> done, there is also no power saving benefit when stopping the tick. >> >> Just in case is wasn't taken into consideration: >> - >> Stopping the tick isn't free on a busy system, but it should also cost >> something to regularly handle ticks on each CPU of an idle system. >> >> FWIU, disabling the ticks also allows to add a CPU to the 'nohz.idle_cpus_mask' >> mask, which helps the idle load balancer picking an idle CPU to do load >> balancing for all the idle CPUs (cf. kick_ilb()). >> >> It seems better to do one periodic balancing for all the idle CPUs rather >> than periodically waking-up all CPUs to try to balance. >> >> - >> I would have assumed that if the system was fully loaded, ticks would >> not be stopped, or maybe I misunderstood the case. >> I assume the wake-up latency would be improved if the tick doesn't >> have to be re-setup again. >> > > Your answer confuses me a little... > > When there is a cpuidle driver, trying to stop the tick is not done > unconditionally. It is only done when the CPU is in a state that it > could go into a deeper C sleep - this is decided by cpuidle > driver/governor. Yes right. > > When there is no cpuidle driver, there is no instance which could bring > the CPU into a deeper C state. But at the moment the code does > unconditionally try to stop the tick. So the aim of the patch is to > remove this unconditional stop of the tick. I agree that the absence of cpuidle driver prevents from reaching deep idle states. FWIU, there is however still benefits in stopping the tick on such platform. - I agree that bringing up/down the ticks costs something and that removing tick_nohz_idle_stop_tick() can improve performance, but I assumed stopping the ticks had some interest regarding energy consumption. Keeping the tick forever on an idle CPU should not be useful. - About nohz.idle_cpus_mask, I was referring to the following path: do_idle() \-cpuidle_idle_call() \-tick_nohz_idle_stop_tick() \-nohz_balance_enter_idle() \-cpumask_set_cpu(cpu, nohz.idle_cpus_mask); \-atomic_inc(&nohz.nr_cpus); Removing tick_nohz_idle_stop_tick() also means not using nohz.idle_cpus_mask and the logic around it to find an idle CPU to balance tasks. Hope the re-phrasing makes the 2 points a bit clearer, Regards, Pierre > > And NOHZ is independant on the cpuidle infrastructure. But when there is > no cpuidle driver, it doesn't makes sense to use then also NOHZ. > > Thanks, > > Anna-Maria > > >