Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4029010ybl; Mon, 3 Feb 2020 11:09:07 -0800 (PST) X-Google-Smtp-Source: APXvYqypFqO9lm1svtoEAfNF0oSR2raUzHaSd2KQWngnauoPU3VJtVrPhYcifT7OEdjqAU+FopfH X-Received: by 2002:a54:4117:: with SMTP id l23mr363859oic.140.1580756946903; Mon, 03 Feb 2020 11:09:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580756946; cv=none; d=google.com; s=arc-20160816; b=DkZYXN4AzGCqKHafX6Et5AImILwwktKcdQ8cr5E1je6YMwEwDjfX4cYjXyfSezJBgT QMHVj75Ky/MTRfyQGNkPz5UYVYglc+zsm9oIKmJiXzQBwwMo1fBTgDYgxoO/QaHf/qjr krGSsUHwn5R4c7hSy2W3i9QoN55EAcxZTa4qWHDSL2mQw78VOL8KmxTUPx2llXaBJLd3 lUWqt5zWB99zMt6JJdMbXLfPFxth04NhStE9hCfpczdW64ectBa1nR+6Pm0XZZ57ci6d /7GR++9P2ZKN1F6C/ii0+heeby5yGL/EB11k/PfQgB+BjRcIFwmdKtRwEXCmOYjpCEJP 7w8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=UbaNwpsedvaUaXe1lV13NffgPd3q1cs2tBUac/xJvpk=; b=0ScOfn2P0ngRRF2nAnVf0+ny3+zNBmoE1l4a+3WcB/uxkIxSGoBimC/hOoydyeC9Lw OlSelhvzhattnXjr9GrZ7xVyUPQkwuLYL9UejwCpn6et0/VKntr8vbRkOLQ1SefekBVC vGRE1nF3XtiicTx/4DiCrlETBAahK8mLM1otRl+M/qPrbp/LAUKXHb1h/8K5k+GI8hwo FHZth+VFQeyz9RMMWxqusa1xbtt5gEzWyy+TB7MDNTJibjPddPI+hk1ckwl88P3D9LtK 3MZVLI2lDaY8hwN7cPKlhJDftMAdXC0si85YXA6oJrgligLeV82HDzKqyX6UoLXISXQ8 EUIA== 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 d79si8580677oib.190.2020.02.03.11.08.30; Mon, 03 Feb 2020 11:09:06 -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 S1729214AbgBCRRv (ORCPT + 98 others); Mon, 3 Feb 2020 12:17:51 -0500 Received: from foss.arm.com ([217.140.110.172]:56538 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbgBCRRv (ORCPT ); Mon, 3 Feb 2020 12:17:51 -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 8348530E; Mon, 3 Feb 2020 09:17:50 -0800 (PST) Received: from e107158-lin (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 344413F52E; Mon, 3 Feb 2020 09:17:49 -0800 (PST) Date: Mon, 3 Feb 2020 17:17:46 +0000 From: Qais Yousef To: Steven Rostedt Cc: Pavan Kondeti , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , LKML Subject: Re: [PATCH v2] sched: rt: Make RT capacity aware Message-ID: <20200203171745.alba7aswajhnsocj@e107158-lin> References: <20191009104611.15363-1-qais.yousef@arm.com> <20200131100629.GC27398@codeaurora.org> <20200131153405.2ejp7fggqtg5dodx@e107158-lin.cambridge.arm.com> <20200203142712.a7yvlyo2y3le5cpn@e107158-lin> <20200203111451.0d1da58f@oasis.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200203111451.0d1da58f@oasis.local.home> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/20 11:14, Steven Rostedt wrote: > On Mon, 3 Feb 2020 14:27:14 +0000 > Qais Yousef wrote: > > > I don't see one right answer here. The current mechanism could certainly do > > better; but it's not clear what better means without delving into system > > specific details. I am open to any suggestions to improve it. > > The way I see this is that if there's no big cores available but little > cores are, and the RT task has those cores in its affinity mask then > the task most definitely should consider moving to the little core. The > cpu_find() should return them! I almost agree. I think the cpupri_find() could certainly do better if the task is already running on a little core. It can fallback to the next best little core if no bigger core is available. I already started looking at pushing a patch to do that. I'm torn about pushing a task already on a big core to a little core if it says it wants it (down migration). I guess since most tasks are fifo by default then one will starve if the other one is a long running task (assuming same priority). But long running RT tasks are not the common case, hence I wanted to hear about what use case this logic hurts. I expect by default the big cores not to be over subscribed. Based on some profiles I did at least running real Android apps I didn't see the RT tasks were overwhelming the system. In my view, the performance dip of sharing the big core would be less than migrating the task to a little core momentarily then bring it back in to the big core. Because the following 2 big ifs must be satisfied first to starve an RT task: 1. We need all the big cores to be overloaded first. 2. The RT tasks on all the big cores are CPU hoggers (however we want to define this) And I think this needs more investigation. > > But, what we can do is to mark the little core that's running an RT > task on a it that prefers bigger cores, as "rt-overloaded". This will > add this core into the being looked at when another core schedules out > an RT task. When that happens, the RT task on the little core will get > pulled back to the big core. I didn't think of using the rt-overloaded flag in this way. That would be interesting to try. > > Here's what I propose. > > 1. Scheduling of an RT task that wants big cores, but has little cores > in its affinity. > > 2. Calls cpu_find() which will look to place it first on a big core, if > there's a core that is running a task that is lower priority than > itself. > > 3. If all the big cores have RT tasks it can not preempt, look to find > a little core. I agree with the above. > > 4. If a little core is returned, and we schedule an RT task that > prefers big cores on it, we mark it overloaded. > > 5. An RT task on a big core schedules out. Start looking at the RT > overloaded run queues. > > 6. See that there's an RT task on the little core, and migrate it over. I think the above should depend on the fitness of the cpu we currently run on. I think we shouldn't down migrate, or at least investigate better down migration makes more sense than keeping tasks running on the correct CPU where they are. > Note, this will require a bit more logic as the overloaded code wasn't > designed for migration of running tasks, but that could be added. I'm wary of overloading the meaning of rt.overloaded. Maybe I can convert it to a bitmap so that we can encode the reason. Let me see how complicated to write something up. Thanks! -- Qais Yousef