From patchwork Wed Sep 20 07:36:11 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: 142573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp4390780vqi; Wed, 20 Sep 2023 13:00:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4sEECO0X6F+pjFBgUXwmqDkoWxuLWRo7NpWQDh67xOhc2St4/VwCo8gvgNL6DqT+ZEKa5 X-Received: by 2002:a17:903:25c3:b0:1c5:cbfb:c16f with SMTP id jc3-20020a17090325c300b001c5cbfbc16fmr1088158plb.25.1695240043823; Wed, 20 Sep 2023 13:00:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695240043; cv=none; d=google.com; s=arc-20160816; b=WE3rKjWX4of9+cAx+F6kNvBhJef++Y+97YyS3RnCKPKXMpG0aAqBkbuuiC8O6Tp1AQ WdGBhG5Bi+Wdm9a7QN4uy28EOcYPAfZPo4mIBrkG0/eC/w3sZGi6WKFQsJ38M4PdNtKm p5f1Eb1FYwXwYM0fuBhFn01H9RVf5WBzZDeLhW4LeyaxH33WJ6TBn8cro5mMSO3jwGir v1RN4b2ApnvO19ij87e4lLweKgQ4yVD3KigfVZjdSz5m6x6HTDkdZdiYtrNjs1sF6X8G ykLOXEA5bNumFxALWL/R3Mxi/LLWoQpxpbu+Ly0vN4OhVeaNzfVfqa4t/5w+VYrGP5pf bZEQ== 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:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=xkErl+ldBpVOFQLYfLc4+s4u3o3sDTlBynk6F5XnIVI=; fh=aKhqIfvWJY69tImLuw3MQoUxiJCpXoGCiBOGzKfx+0E=; b=qKPwFQiFs9rq8e++YrMFwIismjs8VV+W9yA6AbCT1Yi/43jh7Ko4x3KhtVUT3s4rda 2zBilKp1dkZuZG+M0IitdsjAw0zQzgs4+PPU/S9o/MjRS73kWfujpPm49GRa2Z0rm+Bi U6fKLwd99kf2TqRQWCxpHn1xnGJv7e1nKXDhOfbJpMAoWIPuIRpgj5cdvoRkF9PqdDdN dxJDEqjsaRbW2witELpFDWrnuHBRYspcEY3FYBzdyzeN1PDED5ZngsA2w6QW65vn6kQy uWf/o97WFh06qcZCZsLMO5rSBk1AGGz1oXY/uNUjJzohAukfBhJBKgkGxZtKq5K9Mu6D 4jnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=HkzMRkQS; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=e700XXZ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u16-20020a17090341d000b001c4621ac000si8304269ple.246.2023.09.20.13.00.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 13:00:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=HkzMRkQS; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=e700XXZ4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 726D081BAF0E; Wed, 20 Sep 2023 00:36:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233823AbjITHg1 (ORCPT + 26 others); Wed, 20 Sep 2023 03:36:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233790AbjITHgT (ORCPT ); Wed, 20 Sep 2023 03:36:19 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 767D4C9; Wed, 20 Sep 2023 00:36:13 -0700 (PDT) Date: Wed, 20 Sep 2023 07:36:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695195372; 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: in-reply-to:in-reply-to:references:references; bh=xkErl+ldBpVOFQLYfLc4+s4u3o3sDTlBynk6F5XnIVI=; b=HkzMRkQSyu1diMapdr8DdhMVRj/xoen19An/M+ulL9V5LBukkwEsOjCScfw1V2bBzeSAFy /5fARBSnaznDK1OLsb40dI27c0TSUuGG+MJd7M2vVBwuq9Ayry6YhGbgG1Jbg2P7kVhbx1 +Fc3NWe7HFKv30sO6EASKmMzZKT6XKoNLwyjovIN3PHKhLk96H7cL+7TemPJAeHK9O4G6X 36dvCAG1PnhoVNd8h1X9fml3z21jy7TKg/Fdn2zdFICH8+7VH6OR/LSvhCJvdixdFhnhgf rHYYZAmngjrwPozRpw23A82v1e/KkWhQvt401cbT2Jq0Wu+RzV2ltVYNtdI5DQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695195372; 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: in-reply-to:in-reply-to:references:references; bh=xkErl+ldBpVOFQLYfLc4+s4u3o3sDTlBynk6F5XnIVI=; b=e700XXZ40ze5dCUWGbIhuB/MSvQBeQ8jmQ6OzNwby3kDYHqGZmqVgPIM7Tz8kHKbpq5YSC rkQmMD0ZCmcldzAw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] sched: Extract __schedule_loop() Cc: Thomas Gleixner , Sebastian Andrzej Siewior , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230908162254.999499-4-bigeasy@linutronix.de> References: <20230908162254.999499-4-bigeasy@linutronix.de> MIME-Version: 1.0 Message-ID: <169519537134.27769.9940843211389031126.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 (snail.vger.email [0.0.0.0]); Wed, 20 Sep 2023 00:36:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777588024377192020 X-GMAIL-MSGID: 1777588024377192020 The following commit has been merged into the locking/core branch of tip: Commit-ID: de1474b46d889ee0367f6e71d9adfeb0711e4a8d Gitweb: https://git.kernel.org/tip/de1474b46d889ee0367f6e71d9adfeb0711e4a8d Author: Thomas Gleixner AuthorDate: Fri, 08 Sep 2023 18:22:50 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 20 Sep 2023 09:31:12 +02:00 sched: Extract __schedule_loop() There are currently two implementations of this basic __schedule() loop, and there is soon to be a third. Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20230908162254.999499-4-bigeasy@linutronix.de --- kernel/sched/core.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index d555640..1ea7ba5 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6770,16 +6770,21 @@ static void sched_update_worker(struct task_struct *tsk) } } -asmlinkage __visible void __sched schedule(void) +static __always_inline void __schedule_loop(unsigned int sched_mode) { - struct task_struct *tsk = current; - - sched_submit_work(tsk); do { preempt_disable(); - __schedule(SM_NONE); + __schedule(sched_mode); sched_preempt_enable_no_resched(); } while (need_resched()); +} + +asmlinkage __visible void __sched schedule(void) +{ + struct task_struct *tsk = current; + + sched_submit_work(tsk); + __schedule_loop(SM_NONE); sched_update_worker(tsk); } EXPORT_SYMBOL(schedule); @@ -6843,11 +6848,7 @@ void __sched schedule_preempt_disabled(void) #ifdef CONFIG_PREEMPT_RT void __sched notrace schedule_rtlock(void) { - do { - preempt_disable(); - __schedule(SM_RTLOCK_WAIT); - sched_preempt_enable_no_resched(); - } while (need_resched()); + __schedule_loop(SM_RTLOCK_WAIT); } NOKPROBE_SYMBOL(schedule_rtlock); #endif