Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4978127rwl; Mon, 10 Apr 2023 21:27:52 -0700 (PDT) X-Google-Smtp-Source: AKy350YNBcK6q6fxqv/1sXXgu0xL6NSeAFyB6gZkEMxKAnvLBJUptRNQS8XpvlTpT0kX4XQvlPQA X-Received: by 2002:aa7:c3c6:0:b0:4fd:1f7b:9fbd with SMTP id l6-20020aa7c3c6000000b004fd1f7b9fbdmr10496125edr.6.1681187272410; Mon, 10 Apr 2023 21:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681187272; cv=none; d=google.com; s=arc-20160816; b=WS01FJiRwDMkTW/XHdlRzDgp6Sh7l7gSjIuusp6mWK7Xo8M7Z9kstNFvD5mHbacUZA 5iXYVfFKjXpo9MAbosUZql7MDxzxekG6x9dJkbm7f/dP3mPRKtd/TZQ81eLErMLDbmjL mOpW1tH6tQnFe9/5Wac7xLFa6BfUTVpM/S7xCMvT4zZxvFz7bZYR0Wnti18L+P2USlF+ /GhuiChs5QPyWvaLx/54cTnGii1MW/Kxyb1fgYJUB+bE/K1uDDUoehuWttDjdV7O2UNw 5k4J4oBN8IHGW0sdn1lZEpWf5ojltKutiIvYW1RliCO5q/kpiEzVb4rLXZksqBLpi0fv ajSw== 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=JX517IRT7COXCefv+Z6JEfzB3hFBTiM6JAYd9NR6DHw=; b=tjdNaCsUpGfAIHOAAqI7sTZK1NOZHYmOj6yQQ5GM+/MudrSM0TuTm3BmsnwzCCGzfY uDJho6L/OR7gWPHFD0fNTUDxzH0d+Yt9JfaKyswcHjaaiuhtyqrwGd3elIhO1Vi8m08V A7ctko2AJX5/DICUF28AHNSVkc1tTiUX8uZAJB9Id78yZmLJgR7QeHS3Wb53GdS0G1Lc O8XoYVl5PKFZL3AvqCY6gzg0omEPHtl9jazE3ntq1AAut0kLpPeHa4EJ8xRUjk/JPd9I UiosrV+k8LWyez7oqWVVTo4Xtey6vSuZxv2b/zwWsOfCrYAjeIpd86Vh4zgMjupuMdlK ISBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=n9OxpFii; 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 c6-20020aa7df06000000b005048be122e2si7059652edy.514.2023.04.10.21.27.27; Mon, 10 Apr 2023 21:27:52 -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=20210112 header.b=n9OxpFii; 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 S230181AbjDKE0X (ORCPT + 99 others); Tue, 11 Apr 2023 00:26:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230109AbjDKE0K (ORCPT ); Tue, 11 Apr 2023 00:26:10 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE13C30FC for ; Mon, 10 Apr 2023 21:25:36 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id v67-20020a254846000000b00b8189f73e94so30494977yba.12 for ; Mon, 10 Apr 2023 21:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1681187136; x=1683779136; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=JX517IRT7COXCefv+Z6JEfzB3hFBTiM6JAYd9NR6DHw=; b=n9OxpFiiHvxNx2CGROwrN80pWd5CJMjso971ZiubbKw5jiObrq1Mgugo656rBrOxZI ALNs0u7HNNBRzN3hFKunqUuD60DBlEUJuSpu5M63wGVw+oZk7tL/Ft+aZ0bLKw7wP1Jb IJn5E27ux0G9/iqH6GdQ9ZyiXmFtQBbbHVW3IMjByLI5KO0xXyFGvKS57q2/jepT3ZtF xRk9XIm340tUnkDYpUl65TsRljG/MUSXWNAY+85L7vgnqlIlnfFRY/6W/wocYOXk7KHq m22eKPovkhjAGGHSZRv8wh2PZEQJuxXNkF5YuM2gSkkysxEuMgqlM0HwIfMR2UDg9rFy fANQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681187136; x=1683779136; 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=JX517IRT7COXCefv+Z6JEfzB3hFBTiM6JAYd9NR6DHw=; b=pIpPfgA742YbsTa2Art3pA43Aq34lnw55C3P+piGcdVV9/e2bqW6sqmUdnBGKQwOrA FWq055BzxLxO8t/afOjCQLGyGtKXLKNHvtXWM+uACOiD0HmGg+LmplI3YmuqvLXsJILZ 1N8VmpFfwZWCLRTArcsx3tCJiuHfgIgU8OT6FWXv3JPfAJDEYOh1S04OcT59ZmTGgnqg XUtI5NXSHngCXoF3Ti0XbwN+A5LiyQufxbUBtIUuInqO6iS3UVbDzy9BEex2bKU/l5lw +KtbOxcOf41wqPe1Xe9ntxTSWZqh4lTloBSdSbaVo4N4yqP3u4h4wpNREybhKJhsS44I OH4g== X-Gm-Message-State: AAQBX9fEqAjXowjyTnmzxRdYbwMqsJlfVGVC4nNlLLJOOYxpID6CXYCl us+5dL0AXWjqezPUDw0FnbU7AHpBtG9T2k3/k0ZDUtf95pX62go11PJlsrIXUm/OYGU9xPLZRX6 JiU3hH8R5J/UNHuCgDFLSemnLSSooQ2AUH6sCj+qLpjkyCugk0RY1/xRd8cNN94Np6O19KTQ= X-Received: from jstultz-noogler2.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:600]) (user=jstultz job=sendgmr) by 2002:a05:6902:12c7:b0:b26:884:c35e with SMTP id j7-20020a05690212c700b00b260884c35emr10795372ybu.4.1681187136322; Mon, 10 Apr 2023 21:25:36 -0700 (PDT) Date: Tue, 11 Apr 2023 04:25:07 +0000 In-Reply-To: <20230411042511.1606592-1-jstultz@google.com> Mime-Version: 1.0 References: <20230411042511.1606592-1-jstultz@google.com> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog Message-ID: <20230411042511.1606592-11-jstultz@google.com> Subject: [PATCH v3 10/14] 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 , Mel Gorman , Daniel Bristot de Oliveira , Will Deacon , Waiman Long , Boqun Feng , "Paul E . McKenney" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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: Mel Gorman Cc: Daniel Bristot de Oliveira Cc: Will Deacon Cc: Waiman Long Cc: Boqun Feng Cc: "Paul E . McKenney" 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 a9cf8397c601..82a62480d8d7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3776,18 +3776,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.40.0.577.gac1e443424-goog