From nobody Tue Dec 30 14:33:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EBD4C2BB3F for ; Wed, 15 Nov 2023 15:14:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344486AbjKOPOX (ORCPT ); Wed, 15 Nov 2023 10:14:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344472AbjKOPOL (ORCPT ); Wed, 15 Nov 2023 10:14:11 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9CAA1A7 for ; Wed, 15 Nov 2023 07:14:08 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41DAFC433C7; Wed, 15 Nov 2023 15:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700061248; bh=9FyYN/LMD2/fmw8fX0LrTB664VhgSDnzIJOwUJw0Y/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s5m+7PM5vOqzBpNbL1+fn6Ycsl2BUOIivbf/wNwef9DrWYraapI6EjD0i1SiJvFMy 6TbCpVDi4b1Ihc+IpXrvrfcwYC5GveDUg7zyIv9CYD/e7bENZGW2mW6W2h7ibG4AT6 5JrpGoK8wnI64jYVgpKnlQcXkth5RCKe3bnztzcitkEoihyqPiN5MaSlRB4X5LQkjV vlIGQT6RpjUI1ouzn6pt89RalvhyDri6tqBPdFa25uSkP4gOZwr4vZxUGNogdnRnm0 suOyFAz8RHMJQA9Ct/cpWVLqqueumDGCWhU9BtTcV6cj/fSOHRsNR0gTBVKs4Y9RQx b5GfqpUBu5tUw== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Peter Zijlstra , x86@kernel.org, "Rafael J . Wysocki" Subject: [PATCH 4/4] x86: Remove the current_clr_polling() call upon mwait exit Date: Wed, 15 Nov 2023 10:13:25 -0500 Message-ID: <20231115151325.6262-5-frederic@kernel.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231115151325.6262-1-frederic@kernel.org> References: <20231115151325.6262-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" mwait_idle_with_hints() is mostly called from cpuidle which already sets back TIF_NR_POLLING and fold TIF_NEED_RESCHED if necessary. The only non-cpuidle caller is power_saving_thread() which acts as an idle loop and is the only reason why mwait_idle_with_hints() carries a costly fully ordered atomic operation upon idle exit. Make this overhead proper to power_saving_thread() instead which already duplicates quite some cpuidle code. Acked-by: Rafael J. Wysocki Signed-off-by: Frederic Weisbecker --- arch/x86/include/asm/mwait.h | 1 - drivers/acpi/acpi_pad.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/mwait.h b/arch/x86/include/asm/mwait.h index 920426d691ce..c1be3775b94a 100644 --- a/arch/x86/include/asm/mwait.h +++ b/arch/x86/include/asm/mwait.h @@ -134,7 +134,6 @@ static __always_inline void mwait_idle_with_hints(unsig= ned long eax, unsigned lo } } } - current_clr_polling(); } =20 /* diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index bd1ad07f0290..86b57123713f 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -175,6 +175,7 @@ static int power_saving_thread(void *data) stop_critical_timings(); =20 mwait_idle_with_hints(power_saving_mwait_eax, 1); + current_clr_polling(); =20 start_critical_timings(); tick_broadcast_exit(); --=20 2.42.1