Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp26992ybj; Thu, 19 Sep 2019 10:07:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwR5e1nnncdjPZhbKvYeCxtFYjyzMGr9THxSt6gGM9XQJeRl2JeBYV2ef9v7e3x7wNaxucb X-Received: by 2002:a17:906:b204:: with SMTP id p4mr15144321ejz.185.1568912865751; Thu, 19 Sep 2019 10:07:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568912865; cv=none; d=google.com; s=arc-20160816; b=nH+niItbjHWhK0CFu/4bacdwF27nC2dOYUoUj9hWJ4iaRANFOIBNvozUMuW+2rOLej +aUOHzJ183FFRsapvqtm8ycuo7qpAPkIXpx3AKbocBL4oqnV4KClR5gytX0XxpMOX4Eq Q3oJE8G8T8qvg1qlO1kmQViSLGzseulAlP/FfpfBCEh9KdJgB6i6yC17hG+xWHMusEGw CbOtBsdzW4Pd1TFW8C4bYj2oO0RPOpBk7bu86Gu+n1dVXLvJB71IQ3DZSh5960SrpH54 SR/D+MWCY077aj385TBKyA/o5dtsR1UNLTfTdcxWMf33bwIya+Rumn4AxIcPchxFmd3P qnRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+iAm9PNcP/MqvjLYI90Q8a9MlSIBggvtRha4/yfxSjo=; b=bLEUomCtAPx6D38PH877d36EF9b56MFPElpxjtrquD1qdm0eV8xt3oayeZ2tq6FiX6 2Be1mB3nLI5N/C6NjpDpLN9KM3rNPEtUVR2PttW1I+EckE1i1M6gSad66oszz4RzmfXr feHuc9xvpJUtRkMMaQlEaCl5NbTeVCQ9BzDe8xUixIJ3EC7AOYFgJNa/OokeA2aj/RuT QjTaK0Xlzq+r5wWlTU+8Q1JXhcIM7X2UrxWjdHS+3m1TesFxv2Bdix7ktiAOCnlp406A E65z1IO671pOefysjvnLUXHMX13WFX0ohD4DXTDdwc1gC3RRgPR7W6rqPUVeMLITu5F7 yYUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LL11A7S9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si3565443ejr.34.2019.09.19.10.07.22; Thu, 19 Sep 2019 10:07:45 -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; dkim=pass header.i=@linaro.org header.s=google header.b=LL11A7S9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731821AbfISOdK (ORCPT + 99 others); Thu, 19 Sep 2019 10:33:10 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:45760 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727273AbfISOdJ (ORCPT ); Thu, 19 Sep 2019 10:33:09 -0400 Received: by mail-lj1-f193.google.com with SMTP id q64so3791973ljb.12 for ; Thu, 19 Sep 2019 07:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+iAm9PNcP/MqvjLYI90Q8a9MlSIBggvtRha4/yfxSjo=; b=LL11A7S9PPhZPUMJHeB72Hs8rvCUbc4npJmhdqAx0R3688k13FcJsaavtQI4Gie6D6 5bE4wdOBlMEb3cNjI70eyY8TMxrSzSMhJMYt5DWDOgVxOmeId8uLKGhhSHFUOpCIs5ck TDT9zKzbnrwe1RQ3sKU570sKKD0UsSAlBaCUdQJp6r4gXSlnb5zoKVuiUp6AfLfMh15H JTSLVS/JwRuWUptwlfWXp7fFLim+S0v6IPlk9b9mNLKBUvjezs/MfOxUwU6v5XDmbI6C atjg8zRfPFuPa5Yk9ReJYTu3uLIMxbs+VYktJfNtBQNhMTtIZGNJXVwhJr31fRuJVkhl +sVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+iAm9PNcP/MqvjLYI90Q8a9MlSIBggvtRha4/yfxSjo=; b=VBJq9rY+LWlYTFN+AqQYN1+5xRvMq5KzgUbqO06ku2/6B0S0hpfwAofon6NU6IIPKQ /RCx01xS3d9VasZgzbrHCp5R+bvbjdFoqJVjgM9LRfEyekQWYqVymXhyibGOQHdCerYM +vC8AOqLI/UIV5ZLh4kyAVPTWkKCLod8cR4pmwY0kXywle334AFJyhw9ALnozIgE7bK1 5A2msxlOVEmM2+qi61ioVsKhOhrAnDgoSIBYkxJSZgnVoG2FmifClExMyjogpRGSLOn8 qCxSItwtMdjxF2Bk3cLiFMDOx+b8t46ybYZ8uoOQbE40E4uxFsOiJuXgR98NXmbGpasW Awig== X-Gm-Message-State: APjAAAVqoqOEx1Vqj4Rmc5AIP/OF2BRfGySaRkwjhvykDxRixsbPaPOt lY7u25dK8MGt7lXQ2NN6Y/t+gbxFIqYEzZAi8AdrDQ== X-Received: by 2002:a2e:1b56:: with SMTP id b83mr5621468ljb.107.1568903586009; Thu, 19 Sep 2019 07:33:06 -0700 (PDT) MIME-Version: 1.0 References: <1567048502-6064-1-git-send-email-jing-ting.wu@mediatek.com> <20190830145501.zadfv2ffuu7j46ft@e107158-lin.cambridge.arm.com> <1567689999.2389.5.camel@mtkswgap22> <1568892135.4892.10.camel@mtkswgap22> <20190919142315.vmrrpvljpspqpurp@e107158-lin.cambridge.arm.com> In-Reply-To: <20190919142315.vmrrpvljpspqpurp@e107158-lin.cambridge.arm.com> From: Vincent Guittot Date: Thu, 19 Sep 2019 16:32:53 +0200 Message-ID: Subject: Re: [PATCH 1/1] sched/rt: avoid contend with CFS task To: Qais Yousef Cc: Jing-Ting Wu , Valentin Schneider , Peter Zijlstra , Matthias Brugger , wsd_upstream@mediatek.com, linux-kernel , LAK , linux-mediatek@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Sep 2019 at 16:23, Qais Yousef wrote: > > On 09/19/19 14:27, Vincent Guittot wrote: > > > > > But for requirement of performance, I think it is better to differentiate between idle CPU and CPU has CFS task. > > > > > > > > > > For example, we use rt-app to evaluate runnable time on non-patched environment. > > > > > There are (NR_CPUS-1) heavy CFS tasks and 1 RT Task. When a CFS task is running, the RT task wakes up and choose the same CPU. > > > > > The CFS task will be preempted and keep runnable until it is migrated to another cpu by load balance. > > > > > But load balance is not triggered immediately, it will be triggered until timer tick hits with some condition satisfied(ex. rq->next_balance). > > > > > > > > Yes you will have to wait for the next tick that will trigger an idle > > > > load balance because you have an idle cpu and 2 runnable tack (1 RT + > > > > 1CFS) on the same CPU. But you should not wait for more than 1 tick > > > > > > > > The current load_balance doesn't handle correctly the situation of 1 > > > > CFS and 1 RT task on same CPU while 1 CPU is idle. There is a rework > > > > of the load_balance that is under review on the mailing list that > > > > fixes this problem and your CFS task should migrate to the idle CPU > > > > faster than now > > > > > > > > > > Period load balance should be triggered when current jiffies is behind > > > rq->next_balance, but rq->next_balance is not often exactly the same > > > with next tick. > > > If cpu_busy, interval = sd->balance_interval * sd->busy_factor, and > > > > But if there is an idle CPU on the system, the next idle load balance > > should apply shortly because the busy_factor is not used for this CPU > > which is not busy. > > In this case, the next_balance interval is sd_weight which is probably > > 4ms at cluster level and 8ms at system level in your case. This means > > between 1 and 2 ticks > > But if the CFS task we're preempting was latency sensitive - this 1 or 2 tick > is too late of a recovery. > > So while it's good we recover, but a preventative approach would be useful too. > Just saying :-) I'm still not sure if this is the best longer term approach. like using a rt task ? > > -- > Qais Yousef