Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1946471ybv; Fri, 14 Feb 2020 08:40:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzNMs52WKFRyb1dxPYpmmjpjEpacF2SL8TbXNx86u7HD9N+O/V7NA24c2TbjGwiD9o+YKDe X-Received: by 2002:a05:6808:9b4:: with SMTP id e20mr2369302oig.37.1581698450254; Fri, 14 Feb 2020 08:40:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698450; cv=none; d=google.com; s=arc-20160816; b=RgnBQKSsXQlhUa4BVvV3oSoc8CrsYXMehx6yQ097AfNzK+g7JIpu4n0usnA3Dtzu56 41TmKFfhTNM4KerPckRXMpFw7R5A0i5Yl9PUEX6MHBIJBRky+BW+SkB/OT92dC7CAqH6 DNcYUR1eGHz9DtH/7zusfnB0Fqj0/JrzHSh019iocWGlfhv4SNIjTwc1hnnW6jmQNC8r nkmHKMrqe2sd0h96h7Amu39pJgQ08DOZGc23kXOg5nJKj7mDcQRoxRIMcLNgevk58N42 KUF/6mzksrz6elBkk3rRoWAwDeVtE2faVBBb+VEl72OtWApJDRO+m5BRz6nDNe5Qp7DR oKTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=I6DO67EDGWxHkIANF4qL034a9loKqWUeomnGGrIq6Ts=; b=k9NMK7YILt/MKNzhtEFmq9rGxYLSDSHAau/YEpfVcbF+CuBnOS61NhKlcjSJojnlTk +giJ8dvFVVIrc5T7AjUKgP1coDfAFY6IyrFxG+uhQE5D4zyqD7SYF0J2VkPpLyKi+n9K qd0QpFtT53FlgsRi52l9Q9Cs3Ao2+SvuJ4705mJCBiIGGCWZyFxhV7HLghTsYfi10FA5 JaO3NU1o3Dwp0+3f3nZ59KKIlfJjbAAouO3mPJmrd/s7SdNlQr2iK0rU9u24ercC87Ew txPTf+s7YjTYfc6MWTvGpXNciPXmuqCLykbYbYEfmTDq2e84Bn5Ha5r5eC0JKQra5Rv3 AShQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si3668216ots.284.2020.02.14.08.40.38; Fri, 14 Feb 2020 08:40:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405944AbgBNQkE (ORCPT + 99 others); Fri, 14 Feb 2020 11:40:04 -0500 Received: from foss.arm.com ([217.140.110.172]:39270 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405859AbgBNQkB (ORCPT ); Fri, 14 Feb 2020 11:40:01 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F0C81106F; Fri, 14 Feb 2020 08:40:00 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 869E73F68E; Fri, 14 Feb 2020 08:39:59 -0800 (PST) From: Qais Yousef To: Ingo Molnar , Peter Zijlstra , Steven Rostedt , Pavan Kondeti , Dietmar Eggemann Cc: Juri Lelli , Vincent Guittot , Ben Segall , Mel Gorman , linux-kernel@vger.kernel.org, Qais Yousef Subject: [PATCH 2/3] sched/rt: allow pulling unfitting task Date: Fri, 14 Feb 2020 16:39:48 +0000 Message-Id: <20200214163949.27850-3-qais.yousef@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200214163949.27850-1-qais.yousef@arm.com> References: <20200214163949.27850-1-qais.yousef@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When implemented RT Capacity Awareness; the logic was done such that if a task was running on a fitting CPU, then it was sticky and we would try our best to keep it there. But as Steve suggested, to adhere to the strict priority rules of RT class; allow pulling an RT task to unfitting CPU to ensure it gets a chance to run ASAP. When doing so, mark the queue as overloaded to give the system a chance to push the task to a better fitting CPU when a chance arises. Suggested-by: Steven Rostedt Signed-off-by: Qais Yousef --- kernel/sched/rt.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 4043abe45459..0c8bac134d3a 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1646,10 +1646,20 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p) static int pick_rt_task(struct rq *rq, struct task_struct *p, int cpu) { - if (!task_running(rq, p) && - cpumask_test_cpu(cpu, p->cpus_ptr) && - rt_task_fits_capacity(p, cpu)) + if (!task_running(rq, p) && cpumask_test_cpu(cpu, p->cpus_ptr)) { + + /* + * If the CPU doesn't fit the task, allow pulling but mark the + * rq as overloaded so that we can push it again to a more + * suitable CPU ASAP. + */ + if (!rt_task_fits_capacity(p, cpu)) { + rt_set_overload(rq); + rq->rt.overloaded = 1; + } + return 1; + } return 0; } -- 2.17.1