Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3890738imw; Mon, 11 Jul 2022 18:57:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vpPVWPfjZ0f4LH6PFF7jsV320mxwx+p+Azjqt+DP3yMwvNqOVAzKhX4lxGEioa0AM8C04N X-Received: by 2002:a05:6402:11c7:b0:43a:c61c:21cd with SMTP id j7-20020a05640211c700b0043ac61c21cdmr17297004edw.108.1657591019999; Mon, 11 Jul 2022 18:56:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657591019; cv=none; d=google.com; s=arc-20160816; b=rXgusKNuoZRn9c46BXBKEJt3bDk8Xw/IZVx6zioo8O/OdAdjSwK3RlYGFjSg7VJOR+ TBBnVCoKWXg01AL5k34cfCuGdgc/iI1Pcyz/9XQWcX6yw5td1iZzGd6GZ250wOPJjr/x SZlGGyVspqCY1UKoKyw4O7fc6Wp5IzItLbWNPfPLbyxEBM8Ufr7tOQcMRKXjK1hhVtU6 Xon1uMYhV6tLmbxZs/X8fT3UUJtf9BridQ/zBQyPHzcShmMaLOtbKJMedWEcFsuRoVpK Ar2V8eFglBSJkVDk9JQiPTBSzNoBXtI3dXoApTpf45/zXRnPfacO4tknEuRETGj9cDlq xLMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ei9yAA7QrpUbdjMc3HmjzhCQ9jQmC45mh/jU0RZTxVw=; b=spfK9PkX8Zsa4hZ3hTX65vG+81anjQrTO6odtpoGLSHWp4uYxaN61aeS1+02RPB8G3 owYeX1QuI1gH3AeWxMAgHFgy76ch2W/CMifNNfIUj5c9+bnAV9ISmGzgukCu1FAMdYYE ei1XJ9GGVlffY89WonZBUrVcIpJb6Smdy6tz5a6OIyoGEwgVnAe4oD4qTvb5UIRgRKdM Mb3euuY3WDUULohzzhMnbGX+8E3WpzCAPHNSXrUcdfBe7UHZ6VMO7btE8D9F2nvk+d9m iAmpNrv1ecZzEnToH6NOPfCsU0/4LZYTawo7olSvbHm0TXWr6BRskzQq+PD3kLjlQBig vvtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=EQ7Q7mJl; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg21-20020a170907971500b00726347cbb61si13523093ejc.981.2022.07.11.18.56.35; Mon, 11 Jul 2022 18:56:59 -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=@gmail.com header.s=20210112 header.b=EQ7Q7mJl; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231788AbiGLBcn (ORCPT + 99 others); Mon, 11 Jul 2022 21:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbiGLBcl (ORCPT ); Mon, 11 Jul 2022 21:32:41 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E27768D5CC for ; Mon, 11 Jul 2022 18:32:40 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id bh13so6255216pgb.4 for ; Mon, 11 Jul 2022 18:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ei9yAA7QrpUbdjMc3HmjzhCQ9jQmC45mh/jU0RZTxVw=; b=EQ7Q7mJlyAUBbAtNhEhuBBBuTIwOKpa3/AXEhB2TDcC3Odwcrip4c6YZLLObTAg+FO wGI2Q0k1HSuSwooApuW4+iX17E8Ae4WZv+S/JOySwzRBusN/09skTvRlA4B+7RL9f3n0 8qOBuu4cEy6DWoG7ukU80eJsUeDozzSlTHkITVU/oXdbWiIp7saHGOySdsFPPJnMlpkf jaD2TLaoe+IUlQZPRUEYTHDC+YQtgtGLppPuAxdT8oNgLebpm3/5gAcMvuq88itiV6uj ci+xUiWx7GKTEPTcV7B9Bp2BcETS64WnZo2dbsLHULb7N+H9EHAAwrwQfzYCGxiCIK07 OHlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ei9yAA7QrpUbdjMc3HmjzhCQ9jQmC45mh/jU0RZTxVw=; b=7Bhf35CUYBrFd3pRj4h2zQBcxU1Lb6LrJAXz+m9RqwzdLOPTc9nxGBHL2DWaeFTNig tW0IMoJan2zSlegi81sallhJM6ruYxtCL+O+DfbWZ675kSTd7DzCz90QQPqpNxFhgXDd Rw8oqXqfnBfK+CHLxTxDelNnXhJG5MaO1gSGNe8zfXSdt9FZmEqcFRcgGNpq+FIKLl0i v3jdihre1Uixg6W49cUwtCdFAD7ykIgWtvCXTNm4k/b5ChwmOUMq6H5a0K3oA9bQdBCj V0M/oFXZzX1soYNevmfVBSUrlVpHaDmfh2gY8CDbSF7ItCmXuPE33rxtLtT3Y4z8Yjnt JZYw== X-Gm-Message-State: AJIora+aN6iXOr6YozUqm54Lwf/KjxtLqpLkaLJDyjzYMPbKlrxzK1T8 275TtegDJvFGHS/An0EXC7E= X-Received: by 2002:a05:6a00:1a46:b0:525:82e2:a0d3 with SMTP id h6-20020a056a001a4600b0052582e2a0d3mr20837514pfv.48.1657589560437; Mon, 11 Jul 2022 18:32:40 -0700 (PDT) Received: from localhost.localdomain (ec2-13-59-0-164.us-east-2.compute.amazonaws.com. [13.59.0.164]) by smtp.gmail.com with ESMTPSA id g124-20020a625282000000b00518e1251197sm5539620pfb.148.2022.07.11.18.32.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 18:32:40 -0700 (PDT) From: Schspa Shi To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com Cc: linux-kernel@vger.kernel.org, zhaohui.shi@horizon.ai, Schspa Shi Subject: [PATCH v5 2/2] sched/rt: Trying to push current task when target disable migrating Date: Tue, 12 Jul 2022 09:31:25 +0800 Message-Id: <20220712013125.623338-2-schspa@gmail.com> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220712013125.623338-1-schspa@gmail.com> References: <20220712013125.623338-1-schspa@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 When the task to push disable migration, retry to push the current running task on this CPU away, instead doing nothing for this migrate disabled task. Signed-off-by: Schspa Shi --- kernel/sched/core.c | 6 +++++- kernel/sched/rt.c | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index da0bf6fe9ecdc..0b1fefd97d874 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2509,8 +2509,12 @@ int push_cpu_stop(void *arg) if (p->sched_class->find_lock_rq) lowest_rq = p->sched_class->find_lock_rq(p, rq); - if (!lowest_rq) + if (!lowest_rq) { + if (unlikely(is_migration_disabled(p))) + p->migration_flags |= MDF_PUSH; + goto out_unlock; + } // XXX validate p is still the highest prio task if (task_rq(p) == rq) { diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 7c32ba51b6d85..877380e465b7a 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2136,6 +2136,12 @@ static int push_rt_task(struct rq *rq, bool pull) */ task = pick_next_pushable_task(rq); if (task == next_task) { + /* + * If next task has now disabled migrating, see if we + * can push the current task. + */ + if (unlikely(is_migration_disabled(task))) + goto retry; /* * The task hasn't migrated, and is still the next * eligible task, but we failed to find a run-queue -- 2.37.0