From patchwork Mon Nov 13 22:03:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Weisbecker X-Patchwork-Id: 13454474 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 D2D68C4167B for ; Mon, 13 Nov 2023 22:03:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230202AbjKMWDg (ORCPT ); Mon, 13 Nov 2023 17:03:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbjKMWDf (ORCPT ); Mon, 13 Nov 2023 17:03:35 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F22D7D50; Mon, 13 Nov 2023 14:03:32 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEA5FC433C8; Mon, 13 Nov 2023 22:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699913012; bh=sUhE/qFaIDHh5RCqYIo7aaxz5Ifr+Yh3RMfcwpeT7hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f6BJYJRy7C9DwtlCkUkAc2wzutdurdfjjUgqKtEfzDDhKHmQgct2AdQdDH39XP/59 RfRvln9eJ05WKfKE1axkGZgUXurqVVeWyfc7wWLQyMdFQVJL7EyWdtkQ9y3UMpehUk 84GbL37ihxEuB0jgGeLqE60Ui1uLj/qNRlrApyWl0f4nwknRDsGG66EoZGg5x+kp+O LTcpL2jUmCyJk+STYGuvHJpK2LCu8BTytk4VEtxGlFQ5wLvrJ3d7ChpJtGwq6dx8uc qOa22h9C/gpkguVsAU8VKnYwmI2Z0JDA0rlOyvzeAipjSsy9T1USfU08JYz62X20vZ i9fJT0OF7zJjw== From: Frederic Weisbecker To: "Rafael J . Wysocki" Cc: LKML , Frederic Weisbecker , Daniel Lezcano , linux-pm@vger.kernel.org, Marcelo Tosatti Subject: [PATCH 1/2] cpuidle: Remove unnecessary current_clr_polling_and_test() from haltpoll Date: Mon, 13 Nov 2023 17:03:25 -0500 Message-ID: <20231113220326.7933-2-frederic@kernel.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231113220326.7933-1-frederic@kernel.org> References: <20231113220326.7933-1-frederic@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org When cpuidle drivers ->enter() callback are called, the TIF_NR_POLLING flag is cleared already and TIF_NEED_RESCHED checked by call_cpuidle(). Therefore calling current_clr_polling_and_test() is redundant here and further setting of TIF_NEED_RESCHED will result in an IPI and thus an idle loop exit. This call can be safely removed. Cc: Marcelo Tosatti Acked-by: Rafael J. Wysocki Signed-off-by: Frederic Weisbecker --- drivers/cpuidle/cpuidle-haltpoll.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c index e66df22f9695..b641bc535102 100644 --- a/drivers/cpuidle/cpuidle-haltpoll.c +++ b/drivers/cpuidle/cpuidle-haltpoll.c @@ -28,11 +28,8 @@ static enum cpuhp_state haltpoll_hp_state; static int default_enter_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { - if (current_clr_polling_and_test()) { - local_irq_enable(); - return index; - } arch_cpu_idle(); + return index; } From patchwork Mon Nov 13 22:03:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Weisbecker X-Patchwork-Id: 13454475 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 DF55BC072A2 for ; Mon, 13 Nov 2023 22:03:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231516AbjKMWDh (ORCPT ); Mon, 13 Nov 2023 17:03:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230230AbjKMWDg (ORCPT ); Mon, 13 Nov 2023 17:03:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD0FBD6C; Mon, 13 Nov 2023 14:03:33 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFD99C433C7; Mon, 13 Nov 2023 22:03:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699913013; bh=eoPOFwQKBI5DH/2gslFAWw1LIbFtVuvG1rrdOcMjkuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PnuG9IvL/cfjbq3+PKfG7YJgkpJMoQAeklUwZqrQWAv65hjHYmSrUDQ9Cxn3aNMg8 zqrgtWB06wlWD7xEWqtP4YvcMu4YRw09MnCVwFjt6PE1BqCZ5sWgdmiqibDddNK3ep qXvxMTjomFmYW5/+KmVLm8/kd3LH+dWSJjtVulnzAtrTz8ZOvZ288auFM/3j6m4Y3H C7zJYHi4o1p5kGpgMr+JoE/BJhVs+e3hzg7XhVjK4LAhugdF4RNmivre6lQlu7dw83 vFlvlYeLAEkPuKl0PxcjkLcfGQPN4H5nm8y3j4QvuH1D2Hfq1jGyTnIm1q1lv80i+v +O29HMB2R/bVg== From: Frederic Weisbecker To: "Rafael J . Wysocki" Cc: LKML , Frederic Weisbecker , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH 2/2] cpuidle: Remove unnecessary current_clr_polling() on poll_idle() Date: Mon, 13 Nov 2023 17:03:26 -0500 Message-ID: <20231113220326.7933-3-frederic@kernel.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231113220326.7933-1-frederic@kernel.org> References: <20231113220326.7933-1-frederic@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There is no point in clearing TIF_NR_POLLING and folding TIF_NEED_RESCHED upon poll_idle() exit because cpuidle_idle_call() is going to set again TIF_NR_POLLING anyway. Also if TIF_NEED_RESCHED is set, it will be folded and TIF_NR_POLLING will be cleared at the end of do_idle(). Acked-by: Rafael J. Wysocki Signed-off-by: Frederic Weisbecker --- drivers/cpuidle/poll_state.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/cpuidle/poll_state.c b/drivers/cpuidle/poll_state.c index 9b6d90a72601..d5cb3eb85a54 100644 --- a/drivers/cpuidle/poll_state.c +++ b/drivers/cpuidle/poll_state.c @@ -40,8 +40,6 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev, } raw_local_irq_disable(); - current_clr_polling(); - return index; }