Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6580043ybh; Thu, 8 Aug 2019 02:26:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyMJOLdtAGJjKPjILM26WqNEPNmYvVrgyXmklN5K+lD2cbNt3e7Mtoc32zwFAY0Zo/xfwq X-Received: by 2002:a63:f816:: with SMTP id n22mr11715397pgh.175.1565256362274; Thu, 08 Aug 2019 02:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565256362; cv=none; d=google.com; s=arc-20160816; b=eBVeQx2rXLcgm5p4Jb/ZAk41HmcG1UfYYmQe+KpGAXZFtLNgLwhvpExgeoDj8m0VCN QCobjF3GfwfFxzyhfAd+sXPg6ATq4lotdE2Do4imIIkOfNoYoqffkaYJ27IVvNp0ERoJ 0hRcYcoR6gxNb+jNSBthhiSPYqPEUBnHTUuRAq6orgGrCwj3ERdXpzejdZ90Stt5z35I o2zvUwaovslaHKYMaHjTk3ENj0Lj10X3HYaQZYdT1uk1IPlRI3XdSY4kv5FN5tcgeBOt vCZ7fu0lePNt5atXXhjCEP0wqCtTgvOmjUj+r6CbSQAbOdy8rkzpr/39sCaVNu6ePXEs Mq0A== 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=8xc4OhLDbgCIcron9B8MQ3szTIhqfwvrLqUCIVwaUFI=; b=sGEQaCXVfAo99SaJyaibXq5P/qCQRKzAcyy4H9R7kxHdkKGJtI/gChcrj2SCBxmCCz 2ELL+gH0UYNoONpbHVy1m+3WdyJ2hK4ibC4u2IBud0wAXnz4aJBg64Ch2KQPsQgmyzJH YDL+YtePzGg7uRW9YwH8bsfCg2W/PtfLqgc4PePObQwGa/aBMrQvR52c99eORehhKRtV Asy5GDZccHuQLISEwpst3CL21l3c+/IPbldyMuhEnafHNXbokw9ZVltFYRSXvJJDTkM3 uoxtw62vDogO9+8OhVHbaUt92ZwSJhguDSJXCfLC0LdwMXplV3Zz5LIH7BKkqm4EJqH1 LDdw== 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 x4si50220835pln.70.2019.08.08.02.25.46; Thu, 08 Aug 2019 02:26:02 -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 S1732163AbfHHJZA (ORCPT + 99 others); Thu, 8 Aug 2019 05:25:00 -0400 Received: from foss.arm.com ([217.140.110.172]:58758 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730678AbfHHJZA (ORCPT ); Thu, 8 Aug 2019 05:25:00 -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 827791576; Thu, 8 Aug 2019 02:24:59 -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 B172A3F706; Thu, 8 Aug 2019 02:24:58 -0700 (PDT) Date: Thu, 8 Aug 2019 10:24:56 +0100 From: Qais Yousef To: Valentin Schneider Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org Subject: Re: [PATCH 2/3] sched/fair: Prevent active LB from preempting higher sched classes Message-ID: <20190808092455.qavanylzts2vmktk@e107158-lin.cambridge.arm.com> References: <20190807174026.31242-1-valentin.schneider@arm.com> <20190807174026.31242-3-valentin.schneider@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190807174026.31242-3-valentin.schneider@arm.com> 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/07/19 18:40, Valentin Schneider wrote: > The CFS load balancer can cause the cpu_stopper to run a function to > try and steal a rq's currently running task. However, it so happens > that while only CFS tasks will ever be migrated by that function, we > can end up preempting higher sched class tasks, since it is executed > by the cpu_stopper. > > I don't expect this to be exceedingly common: we still need to have > had a busiest group in the first place, which needs > > busiest->sum_nr_running != 0 > > which is a cfs.h_nr_running sum, so we should have something to pull, > but if we fail to pull anything and the remote rq is executing > an RT/DL task we can hit this. > > Add an extra check to not trigger the cpu_stopper if the remote > rq's running task isn't CFS. > > Signed-off-by: Valentin Schneider > --- > kernel/sched/fair.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index b56b8edee3d3..79bd6ead589c 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -8834,6 +8834,10 @@ static inline enum alb_status active_load_balance(struct lb_env *env) > > raw_spin_lock_irqsave(&busiest->lock, flags); > > + /* Make sure we're not about to stop a task from a higher sched class */ > + if (busiest->curr->sched_class != &fair_sched_class) > + goto unlock; > + This looks correct to me, but I wonder if this check is something that belongs to the CONFIG_PREEMPT_RT land. This will give a preference to not disrupt the RT/DL tasks which is certainly the desired behavior there, but maybe in none PREEMPT_RT world balancing CFS tasks is more important? Hmmm -- Qais Yousef > /* > * Don't kick the active_load_balance_cpu_stop, if the curr task on > * busiest CPU can't be moved to dst_cpu: > -- > 2.22.0 >