Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp283493rwd; Wed, 31 May 2023 23:30:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5/Yqc0mVSWKykOYQ8OjS0S6cROtZyQHFOtsxpkAMlQDFy0sFo1VM+VmOxA/tMIdUdttXpa X-Received: by 2002:a17:902:e884:b0:1b0:7c3c:31ed with SMTP id w4-20020a170902e88400b001b07c3c31edmr3839233plg.25.1685601021448; Wed, 31 May 2023 23:30:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685601021; cv=none; d=google.com; s=arc-20160816; b=jKocGoze8Nw9x1tbbGAK7HL2Kf91ZE2YiwVtKw7ksiHxVEkCzDNQOOboUEFZTRON/d 5Vg1riezf0BPn/vh7t86dtppCBq4OqNqqZnsiLeeqKWj2s8Q/oal5EaKiI9TR9ZoFqbW 2yKd6aOXmsZaQx29E5OZ4f5g+ExM14oiB/jKSKiQR4apw/8YzBkcVx4C5MlT4labqfmW RJbyttTO7IAytZDD1xL8RWy7SXkSwc+ozoaY/aBCihR7DbxLNFMwqnb4lELKlaqGn9+S ePatSjbBd3GtMOgI3vTWzqXtQUtEa/vHK/K4xnvK8TNh0V9lNSc5kCLN2Gtn2S2iiJOf 6Peg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=dZ6JJUxxg/evvLbMiOXiQLvIE2NeWkgAOuvpFCCCZeI=; b=R8jMGlL7PbpeQDV2yI+vraefS638CzoqAaN4kY4WavmFXibonmu6mopwi14vQo8iLH wfQamPrJSQ9Z4BGJTM9EQscxbAX305vP3u8Jpxa6hhGOSb123uJXNYjradTdL/41/0Re oxkHF6JeHI5+/vh1b2xCU7kcGapCRhYFgz7SDUUge+VdK3PiOYIzkhkivbpZKrMoZdRX OcVy/vNThcm+QvNl551ElgJ+H5XUVHa4coWXfWHByZNg/ApE1ccBp2/FFYj3YM5/nBX9 x2ycMuh5I7gkWjuzT7JGKC9bmdkPRvs6GQNdsDq18aArjVCQtuhwpzGf8mwr6rjAsyY6 wArg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=nFzjfejd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 21-20020a170902c15500b001a699fc81e8si2209324plj.98.2023.05.31.23.30.10; Wed, 31 May 2023 23:30:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=nFzjfejd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231221AbjFAF75 (ORCPT + 99 others); Thu, 1 Jun 2023 01:59:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231710AbjFAF70 (ORCPT ); Thu, 1 Jun 2023 01:59:26 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE57F1AB for ; Wed, 31 May 2023 22:59:10 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5659c7dad06so7674347b3.0 for ; Wed, 31 May 2023 22:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1685599150; x=1688191150; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=dZ6JJUxxg/evvLbMiOXiQLvIE2NeWkgAOuvpFCCCZeI=; b=nFzjfejdNuWfdbeW4COw8TITHM2+jzSeY30W6HIzeIEw0KdLMx6fFyQFq8IVguNPLE sPRZrxLlxrcuAkAn1vOhW4h19JugrwPcwiK09MKVkdGSDKX6+5riWbw+VMIk9JYqlJoh EWjQLwxPIYklx5Bd7nRr8pzjpd0lZVcph9z3qrvCzH3frC6vLVnBSXl2d4uMGnrnSEr0 0lfXsKiXUSM0M4F3tqVNqhQIg23UqzLOGE4jfjQpY/22dJDgcwOs2QAdIu8UL/BsUHw7 gLyl5SMnIg27SOZUO2XgQR1SvSq+WQ3LJUpZ/7jDB3n3UJC9wa0ijIm72rstIVv2ucAT 1Cvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685599150; x=1688191150; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dZ6JJUxxg/evvLbMiOXiQLvIE2NeWkgAOuvpFCCCZeI=; b=e5veZnNCV+71lZOR4ssDZf7wHjvQDVpR7B2gHS/Gu+e4CLIh+bqJqO4pIPXkqJ/LcA 9GuKdvI4c8IxCKpJYjF7MiALAwNkdQc8HsqYbs1TskILoCy3WOvG748FDEJToJO82jGx 1oAHqh7ftobGQSjLAx0021Ga9kLdpTPkUVOrExPTXH/UsBmppV0F214zwFqumTt9kvW/ s78VWTKivY9+LhF/E+XDDdCDKdskZ7RmvLc7dWcTq/NPKbSS+V3BfHsyN9awoh8K/PvU yiHR3pBNH8xmki32DTAqqDsfYxjdyj/6bvhNfomjU6uLPKKQy/iw5lk37swWc83z2DiY NquA== X-Gm-Message-State: AC+VfDwRlhOw0AHUQ09YeINYLBhtcaM/qDSgeegC888s93/ytydTgd1J 6uCwW4tpTCH4OKXbiK+wPDyvaSwxw7ECp255ndYZ0F1GOdPrkwQWGQbnPDaYjKGZKrjGGAY7Mes 4P/ZVX9a7KgPXPpSnrLktkzrw8UOi8ckud2jhWrRQFH1gzXrX+i0iljyvLa2FVYcoZ9QL73I= X-Received: from jstultz-noogler2.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:600]) (user=jstultz job=sendgmr) by 2002:a81:ad5e:0:b0:565:b765:3fb with SMTP id l30-20020a81ad5e000000b00565b76503fbmr4718726ywk.9.1685599150121; Wed, 31 May 2023 22:59:10 -0700 (PDT) Date: Thu, 1 Jun 2023 05:58:11 +0000 In-Reply-To: <20230601055846.2349566-1-jstultz@google.com> Mime-Version: 1.0 References: <20230601055846.2349566-1-jstultz@google.com> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog Message-ID: <20230601055846.2349566-9-jstultz@google.com> Subject: [PATCH v4 08/13] sched: Unnest ttwu_runnable in prep for proxy-execution From: John Stultz To: LKML Cc: John Stultz , Joel Fernandes , Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Steven Rostedt , Ben Segall , Zimuzo Ezeozue , Youssef Esmat , Mel Gorman , Daniel Bristot de Oliveira , Will Deacon , Waiman Long , Boqun Feng , "Paul E . McKenney" , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 Slightly rework ttwu_runnable to minimize the nesting to help make the proxy-execution changes easier to read. Should be no logical change here. Cc: Joel Fernandes Cc: Qais Yousef Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Valentin Schneider Cc: Steven Rostedt Cc: Ben Segall Cc: Zimuzo Ezeozue Cc: Youssef Esmat Cc: Mel Gorman Cc: Daniel Bristot de Oliveira Cc: Will Deacon Cc: Waiman Long Cc: Boqun Feng Cc: "Paul E . McKenney" Cc: kernel-team@android.com Signed-off-by: John Stultz --- kernel/sched/core.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index ace75aadb90b..3dce69feb934 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3799,18 +3799,20 @@ static int ttwu_runnable(struct task_struct *p, int wake_flags) int ret = 0; rq = __task_rq_lock(p, &rf); - if (task_on_rq_queued(p)) { - if (!task_on_cpu(rq, p)) { - /* - * When on_rq && !on_cpu the task is preempted, see if - * it should preempt the task that is current now. - */ - update_rq_clock(rq); - check_preempt_curr(rq, p, wake_flags); - } - ttwu_do_wakeup(p); - ret = 1; + if (!task_on_rq_queued(p)) + goto out_unlock; + + if (!task_on_cpu(rq, p)) { + /* + * When on_rq && !on_cpu the task is preempted, see if + * it should preempt the task that is current now. + */ + update_rq_clock(rq); + check_preempt_curr(rq, p, wake_flags); } + ttwu_do_wakeup(p); + ret = 1; +out_unlock: __task_rq_unlock(rq, &rf); return ret; -- 2.41.0.rc0.172.g3f132b7071-goog