Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp839739ybl; Fri, 30 Aug 2019 07:57:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7MmeHxtuyeG7aw5mAU1e6WLv73LN2qQcsVZiUtdpfyUlgWtw0ryKmyM2KBzoOk2/Bw4s4 X-Received: by 2002:a63:7205:: with SMTP id n5mr13236501pgc.443.1567177063803; Fri, 30 Aug 2019 07:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567177063; cv=none; d=google.com; s=arc-20160816; b=oAtSyama/xAoLYSvzmAdCPm1kYXArIZsn+URyCOcEKX2TS7OW0jz5FABoyaEkSI2W6 AzZIMUrhtmQSM1xCeIe83h1hx7Yv3lKViZLDNfCIzfMNeMIqlqKYKK6wDWaLAQHeGXt5 fbTM8lw+7jelSF5mp4yB0ugGvW7NbtbPx+SmM1fBd5LgdzcMDL8KIFswTXcIlEuu8jwA C8CJMqQk4dEvDR35YJypKqk/kZPrdw1X5RuULp+mJek0vtmevy11oBM6vA+v41a6u942 z4I7hj0Pxjjcp57qWISW2loCQnK+oluVF+DjTHAjZ02Ef9yUQ86MWEJ5FlM2aYmcOPk3 lbZg== 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=boGaW3rKRBNToSZlptMPUA0+/M2SCbl1QM4N0JSheHY=; b=j0sONpl8HsbbdPmluqMYIN2gbwyrvHASLpNKJgxfmmNmiWUtsPk5fscQWS+D0GubXL Bayn54Z2PK9EodxEZcELckFwfexqAJxPHAxDno66xbmfCK/RvGMtCjOp7evgG0cYS0HW 6X6NUBuFkkBhasU2DP4zXnH1OCuoZjwD1/0qgXD6tFZ7s7lGgXY+JWMyLBfEApFvE1rB 1kkDvQTbAAcsMTwrJ5GrcSETiqvqqhcVK5QbCBtl3YrqYLfwAE/mNXMB7iW223Tk2KeB G2/fqC4CIKeoJgjnPi0ABWqhVAUIgweAs65du9AUCUM370IC1aXeIvZPinrQAM7eXR2d FEpg== 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 h1si5113058pjb.40.2019.08.30.07.57.28; Fri, 30 Aug 2019 07:57:43 -0700 (PDT) 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 S1727979AbfH3OzJ (ORCPT + 99 others); Fri, 30 Aug 2019 10:55:09 -0400 Received: from foss.arm.com ([217.140.110.172]:33474 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727924AbfH3OzG (ORCPT ); Fri, 30 Aug 2019 10:55:06 -0400 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 C500F344; Fri, 30 Aug 2019 07:55:05 -0700 (PDT) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.194.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A0C2E3F703; Fri, 30 Aug 2019 07:55:04 -0700 (PDT) Date: Fri, 30 Aug 2019 15:55:02 +0100 From: Qais Yousef To: Valentin Schneider Cc: Jing-Ting Wu , Peter Zijlstra , Matthias Brugger , wsd_upstream@mediatek.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH 1/1] sched/rt: avoid contend with CFS task Message-ID: <20190830145501.zadfv2ffuu7j46ft@e107158-lin.cambridge.arm.com> References: <1567048502-6064-1-git-send-email-jing-ting.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/29/19 11:38, Valentin Schneider wrote: > On 29/08/2019 04:15, Jing-Ting Wu wrote: > > At original linux design, RT & CFS scheduler are independent. > > Current RT task placement policy will select the first cpu in > > lowest_mask, even if the first CPU is running a CFS task. > > This may put RT task to a running cpu and let CFS task runnable. > > > > So we select idle cpu in lowest_mask first to avoid preempting > > CFS task. > > > > Regarding the RT & CFS thing, that's working as intended. RT is a whole > class above CFS, it shouldn't have to worry about CFS. > > On the other side of things, CFS does worry about RT. We have the concept > of RT-pressure in the CFS scheduler, where RT tasks will reduce a CPU's > capacity (see fair.c::scale_rt_capacity()). > > CPU capacity is looked at on CFS wakeup (see wake_cap() and > find_idlest_cpu()), and the periodic load balancer tries to spread load > over capacity, so it'll tend to put less things on CPUs that are also > running RT tasks. > > If RT were to start avoiding rqs with CFS tasks, we'd end up with a nasty > situation were both are avoiding each other. It's even more striking when > you see that RT pressure is done with a rq-wide RT util_avg, which > *doesn't* get migrated when a RT task migrates. So if you decide to move > a RT task to an idle CPU "B" because CPU "A" had runnable CFS tasks, the > CFS scheduler will keep seeing CPU "B" as not significantly RT-pressured > while that util_avg signal ramps up, whereas it would correctly see CPU > "A" as RT-pressured if the RT task previously ran there. > > So overall I think this is the wrong approach. I like the idea, but yeah tend to agree the current approach might not be enough. I think the major problem here is that on generic systems where CFS is a first class citizen, RT tasks can be hostile to them - not always necessarily for a good reason. To further complicate the matter, even among CFS tasks we can't tell which are more important than the others - though hopefully latency-nice proposal will make the situation better. So I agree we have a problem here, but I think this patch is just a temporary band aid and we need to do better. Though I have no concrete suggestion yet on how to do that. Another thing I couldn't quantify yet how common and how severe this problem is yet. Jing-Ting, if you can share the details of your use case that'd be great. Cheers -- Qais Yousef