From patchwork Mon Sep 18 06:21:23 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: 141414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2649287vqi; Mon, 18 Sep 2023 06:14:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHz8dXn5DTGBwgk8R/RMh4fCPOhBvkLe5ATXU8VSURGzvGjlfcoP2CfHurVRO6c04llhk3b X-Received: by 2002:a17:903:186:b0:1bd:aeb3:9504 with SMTP id z6-20020a170903018600b001bdaeb39504mr11886299plg.15.1695042866785; Mon, 18 Sep 2023 06:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695042866; cv=none; d=google.com; s=arc-20160816; b=bRZBDejwQXEp10fh+FPg0JmGbKzA9fSGOnqxGmmtz2kWXm3dZZBURPbuiWew8/g5nY LFVb7HhgIBsPDZRyuBMtmqz+4iGPXgvrcUXo8HOC3gwht6I16BbcEUAOGNvNeebTaJ7V lX33X4g1BY6WYE+Azw98v9faY17sn5j3PYcVW7oi6rEPqnfPQ8UfNLx6AixNI+m+GgCd LzIIyMJg6LpBOj7R2gGw4isGUUh1XGIW+n69d2sU+QxycpkQbvPbhSi5Bi8htfBOZKxB AucyXE3hVubQ3qpHmvydZst9euYeglWmrqrgLIHrxX3QVLNSZd4LPcmzVjY+XPDWunQZ jmJQ== 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=qvDfBkQCd44w6tZnHtxeHXhGITJN6OtsLGSgzCBimoE=; fh=YrrAW9K6pi4U+Ajml8lWlsUhTbvfrzcfxD8ctvXf6Vw=; b=1AtRQXCzEKvFltiMEvgK8vXZRNIGOREDTVqXme39eEVG/uYrothiwXb0IqJ5rk0lkb MJoFojkYmXx5mb+GzWZ2Z2fbazvGf9nNiolk65immJtRQ1z1sg2ks/LdNowMuyHcQF2+ 8wV3xLhZMfmeSsIerEEgCSSArEwuRTDCjYVQPpHe77wCA4S2OD/PHNeZUOdFcvltrys6 dO//ZliHaQrLbEr2NiY6hAT5vszjuGamdh3jRkxus4is/kjjRLsmnb7LCDvbXy1Hksji p+OA4oA4zDc6xfBf6fqFlRc+5NNcRQXgUSuj4Wz5ZNBhd5nxG9pwXFlVO6xLkJTYKRXa UGwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1hjUvyZG; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=y5eCebUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id h5-20020a170902f54500b001bdd35033f4si3334057plf.387.2023.09.18.06.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 06:14:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1hjUvyZG; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=y5eCebUH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 3CE26807DE00; Mon, 18 Sep 2023 00:41:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240164AbjIRHke (ORCPT + 27 others); Mon, 18 Sep 2023 03:40:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240399AbjIRHkV (ORCPT ); Mon, 18 Sep 2023 03:40:21 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2341F170E; Mon, 18 Sep 2023 00:38:14 -0700 (PDT) Date: Mon, 18 Sep 2023 06:21:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695022692; 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=qvDfBkQCd44w6tZnHtxeHXhGITJN6OtsLGSgzCBimoE=; b=1hjUvyZGt661iLpkU8nVLVvhkN0+CtXrlUOgp+TGeNRhvfs6FH9BoDP+ZI8h4mWilZ3YWT wejHs0Dq1kuQVzTQuEP11jTvotcKpHG6phrJEMQdwpxCrPGi1kCnqHw25S0M4UKHaPkK8O BR4t5Fxl4wPIvYeVbuBgbpfWbsj1V8op/Kg3ekndZb+AH44opwyJ4Bzj1MXAuanWw+i7bQ RFv3BhZV6yyrNQ1pfKWgc99PBnWNvn1cYhrK7yc/d8iq72S/6YK6xh0CR0YrmAMyFt1IFc EKG5+hfZdEfAcAGDi2+rlaUQQiM7F4/OO/4KLL0F4kbiJB+eE5UHE5naLFGgPQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695022692; 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=qvDfBkQCd44w6tZnHtxeHXhGITJN6OtsLGSgzCBimoE=; b=y5eCebUHPtKs6F+4Sw/I09Tu2Jxcc04RuTK51uPYUJzoR/+r8IQr6LMo27P6/WuPraF1hY 4d93qFqerFr7A2BA== 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 , "Peter Zijlstra (Intel)" , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <169501808389.27769.10252810804131112374.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Mon, 18 Sep 2023 00:41:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777381269008749695 X-GMAIL-MSGID: 1777381269008749695 The following commit has been merged into the sched/core branch of tip: Commit-ID: fbaa6a181a4b1886cbf4214abdf9a2df68471510 Gitweb: https://git.kernel.org/tip/fbaa6a181a4b1886cbf4214abdf9a2df68471510 Author: Elliot Berman AuthorDate: Fri, 08 Sep 2023 15:49:15 -07:00 Committer: Ingo Molnar CommitterDate: Mon, 18 Sep 2023 08:13:57 +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 Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar --- 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; }