From patchwork Sun Sep 17 10:12:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 141142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2088552vqi; Sun, 17 Sep 2023 04:41:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYKK3JBzR+ICQ0+m1QiIQ1Y/6zXzG6MjhF5FGN6EPNJsnHChONLXT+L6p9uoElHoeji//J X-Received: by 2002:a05:6358:2612:b0:134:ded4:294 with SMTP id l18-20020a056358261200b00134ded40294mr8674441rwc.17.1694950889190; Sun, 17 Sep 2023 04:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694950889; cv=none; d=google.com; s=arc-20160816; b=BAx1S3Rfqz5/PEV2zDT+FS4tiP7PgqdlMyPbNIEp77j7n+MbO8jiJLm1xc7N+GI8NG 3K1Nqm2G3oEXstWoJlMOm+khhYUkwq+EWL6/5a3rLAEl6YgRvbj5vHD1BbCKEEbOW8F8 jFBliDtwEptslrvJFka1GMF5u5M6xY2JfXBCjIR8dxr7BNTlsgXyyeIPmPay+w3OJycv ADaY2IQG1kT8aB0evUXEfc4M4Rq94TbhKno90Q2HiFWnPFCWC7Xuy4jfPKjM2QAvimGa Ig0clc9o5pudOSWqnX+lt3HoQcx5rwXXwgUfwGcATOtDgt5aRE9ogEKINpFWRG8fP1Ue bQJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=tVm7gmJMnGdDCZVKEuiJdX7a159lvd+qt6GKxewQjf0=; fh=h+wipmKbvGy5lXayd4O9OXD7MrnWzfsCWmkH1wHPWIE=; b=mbL33m0EqkrF1hl2mODv+riEYMFb8YAd584wwYcnklL4/IJDfpjbBEtk9sCKdadDdR kAwO89Q8TCjnJvFWDE7d83KxFoCOBlOBDqCC9uS/j680/qEpa4ARmaTtcdOByDhg0uqK 0nJAwLUEcixoNGLCr8jtUHdSj3UQH1OBR6K66LZoIJVTGEBYCWl5XuPPGsdoRygN3Q7y AJZX6PF8xCwQI98V6lVLAEeH3UkZ7El2efck8x8Do0nbQpl0cPKCkdAbBpYLeC7ICqht xBkTgUTvHN3N2HtaJTcnFtwkxt+wOu+c7fMJiILVf5P8CplKENS9Nn0NlJMCl5Tmn8Cl Lllg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=IBYMk0xT; dkim=neutral (no key) header.i=@linutronix.de header.b=9MbrTzjc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id ck15-20020a056a00328f00b0068e3b121545si6389329pfb.58.2023.09.17.04.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 04:41:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=IBYMk0xT; dkim=neutral (no key) header.i=@linutronix.de header.b=9MbrTzjc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id C5B2680FCBE6; Sun, 17 Sep 2023 03:13:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232729AbjIQKMn (ORCPT + 29 others); Sun, 17 Sep 2023 06:12:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236194AbjIQKMR (ORCPT ); Sun, 17 Sep 2023 06:12:17 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E2DC197; Sun, 17 Sep 2023 03:12:10 -0700 (PDT) Date: Sun, 17 Sep 2023 10:12:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694945528; 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; bh=tVm7gmJMnGdDCZVKEuiJdX7a159lvd+qt6GKxewQjf0=; b=IBYMk0xTWKgxyi8TSjN+yS5E2ENVZ6cmek62kHknkR0yHBDWA7K8Fy1ooz2pqXYVnNjfUz Eo79UXzwNiBCwa3dQB01B8/gVTBnA9zH+j7w2GIDZspAxSrs2jte/QrwLbmc+T/CPyDuW8 +RhC0YjBy6Pr7xjZHIOpoDA0TUkFSHIC73ZZdjfZBIQc5Bsr1fgPgBj+ezp4gLeETkYRfP lSgVbnDVHzODALqMFZ5WQ8yVt0ujHKiOUbZQhHtq8TmgmLth4zLru7QCMsoTCCW0UYDEFL JfALEcTQTXJ5poPQ6O2MR1STqyV4oDbTaEoGL3DK73J+M+eX8yrwebJrKI/7cQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694945528; 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; bh=tVm7gmJMnGdDCZVKEuiJdX7a159lvd+qt6GKxewQjf0=; b=9MbrTzjcm9JM0yaw+mkJoRqkfDzAyYZLZZ6CIElaHVYukgUrc5GeSujOGiL5sRhaLKm8ea mmw47X3XK7dVAfDg== From: "tip-bot2 for Elliot Berman" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/core: Remove ifdeffery for saved_state Cc: Elliot Berman , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <169494552813.27769.7209596078545807501.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 17 Sep 2023 03:13:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777284823698251861 X-GMAIL-MSGID: 1777284823698251861 The following commit has been merged into the sched/core branch of tip: Commit-ID: fa14aa2c23d31eb39bc615feb920f28d32d2a87e Gitweb: https://git.kernel.org/tip/fa14aa2c23d31eb39bc615feb920f28d32d2a87e Author: Elliot Berman AuthorDate: Fri, 08 Sep 2023 15:49:15 -07:00 Committer: Peter Zijlstra CommitterDate: Sat, 16 Sep 2023 11:16:01 +02:00 sched/core: Remove ifdeffery for saved_state In preparation for freezer to also use saved_state, remove the CONFIG_PREEMPT_RT compilation guard around saved_state. On the arm64 platform I tested which did not have CONFIG_PREEMPT_RT, there was no statistically significant deviation by applying this patch. Test methodology: perf bench sched message -g 40 -l 40 Signed-off-by: Elliot Berman --- include/linux/sched.h | 2 -- kernel/sched/core.c | 8 ++------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 77f01ac..dc37ae7 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -750,10 +750,8 @@ struct task_struct { #endif unsigned int __state; -#ifdef CONFIG_PREEMPT_RT /* saved state for "spinlock sleepers" */ unsigned int saved_state; -#endif /* * This begins the randomizable portion of task_struct. Only diff --git a/kernel/sched/core.c b/kernel/sched/core.c index f39482d..49541e3 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2232,23 +2232,20 @@ int __task_state_match(struct task_struct *p, unsigned int state) if (READ_ONCE(p->__state) & state) return 1; -#ifdef CONFIG_PREEMPT_RT if (READ_ONCE(p->saved_state) & state) return -1; -#endif + return 0; } static __always_inline int task_state_match(struct task_struct *p, unsigned int state) { -#ifdef CONFIG_PREEMPT_RT /* * Serialize against current_save_and_set_rtlock_wait_state() and * current_restore_rtlock_saved_state(). */ guard(raw_spinlock_irq)(&p->pi_lock); -#endif return __task_state_match(p, state); } @@ -4038,7 +4035,6 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success) *success = !!(match = __task_state_match(p, state)); -#ifdef CONFIG_PREEMPT_RT /* * Saved state preserves the task state across blocking on * an RT lock. If the state matches, set p::saved_state to @@ -4054,7 +4050,7 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success) */ if (match < 0) p->saved_state = TASK_RUNNING; -#endif + return match > 0; }