Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4630215ybz; Tue, 28 Apr 2020 15:14:32 -0700 (PDT) X-Google-Smtp-Source: APiQypIQgYVaq3pYPv8FNPC+dDYzLc06Euu56xCc/Rv9AgVJtSvzTnAF4rVKFZyDxQFeCbX7zTmy X-Received: by 2002:a17:906:9482:: with SMTP id t2mr26059081ejx.241.1588112072022; Tue, 28 Apr 2020 15:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588112072; cv=none; d=google.com; s=arc-20160816; b=FT1Bw2t3qjmMzZt+hL1tIU+AaT3q6meTs/EXSNxVKkxFK8tOu48pg6RRK5+msvO3Gg AOPzG2HY4ar6sDXM1oXs+PCi6apARHUFa0n/hjDncch6yEcsJbpxYEEE8ZQgB/Uxb6Qg y2618CxiNKmbood4zApwdEWFieMH1hbu67UUo2Z3MksofAekLMiEW0dnRgkd1N1WLoGd Aas/4Dqjigv/C0ag/ClV5BTTTwi5vZl1mAT41zSp8mG2zyMVeIzE2Bo7vxoenH8DF158 vGHMSoOYHFIo/9DFsipvUNtFWqxR/2r5+9etn/VXrVAXV3dqIqCbeaUX02M4RIfn32iL K0Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=i0UfKrqGLok7Kx5f2Cnl5Y270Tvst3mtRJd6yLGqJ7Q=; b=zuYGBeBxdzdi6PEZDflaYIZIq1lO7u5Q72R1YelzpdnTq8+pkRGAdATu2Ok94f6R58 CqnpI3WyilbgZmW4+pq87S+2K1QKC1YjL+LVDrVRQyP1KMciJrCYRW5zdIt+QRUTEHaO OGOobIdjrB/CSGShiMdM+gpyaGgzZRObuZ+c2ji+g4HDdO/MaEHpkX9c7cMpqvFCI4jQ 7djgp/eCOXTDW8oQ8zUJi8oWSwbJ8N77KJ4y2gacvxxQhCuSwPst0frG2W5VmsJl/03z wsSZGpHU8ruWma9YxV15L90c96CEQN39qRHHBz6ikqeKvcxkAw7MzeXnPrTu2jsn57M+ lv+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Kf6lgipz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si2505190edr.204.2020.04.28.15.14.08; Tue, 28 Apr 2020 15:14:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Kf6lgipz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726361AbgD1WJy (ORCPT + 99 others); Tue, 28 Apr 2020 18:09:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726333AbgD1WJy (ORCPT ); Tue, 28 Apr 2020 18:09:54 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 024E0C03C1AC; Tue, 28 Apr 2020 15:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=i0UfKrqGLok7Kx5f2Cnl5Y270Tvst3mtRJd6yLGqJ7Q=; b=Kf6lgipzK8W4jussQcrLvosJGP BWWpUDPQ4c1/fRbFfTLIiMSiRrJv4jMyvhi4dSuZaSXocSoI5VPcjJNMspUEfKsoE/qp6TW7Mb0oY OYDJz3lYCZbAlXbeyzfZzVp0R4cR+0SGTMh+PjdxeGg2ntiapu3vswq28kuD2k2QBTFPveLj4wqeu wHmpRdvu4caEBo3FIgpvlX0t3HOeTUeEqfszfmJfetg9aNe5fUepdPTsk3+38aRagkH7POjETbWl3 c2Ca/hPvRG97k4r13U/hBBCDTCsVJQJLvw8FRE7tqOJh0dmBxnwjvUwT+cEt14ezIZnPV3LHLEkQc ISDCgZlQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jTYPo-00040d-Ce; Tue, 28 Apr 2020 22:09:20 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B45F2301224; Wed, 29 Apr 2020 00:09:17 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 96CB8286C2DCC; Wed, 29 Apr 2020 00:09:17 +0200 (CEST) Date: Wed, 29 Apr 2020 00:09:17 +0200 From: Peter Zijlstra To: Valentin Schneider Cc: Scott Wood , Steven Rostedt , Ingo Molnar , Vincent Guittot , Dietmar Eggemann , Rik van Riel , Mel Gorman , linux-kernel@vger.kernel.org, linux-rt-users Subject: Re: [RFC PATCH 1/3] sched/fair: Call newidle_balance() from finish_task_switch() Message-ID: <20200428220917.GB16027@hirez.programming.kicks-ass.net> References: <20200428050242.17717-1-swood@redhat.com> <20200428050242.17717-2-swood@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 28, 2020 at 10:37:18PM +0100, Valentin Schneider wrote: > > On 28/04/20 06:02, Scott Wood wrote: > > Thus, newidle_balance() is entered with interrupts enabled, which allows > > (in the next patch) enabling interrupts when the lock is dropped. > > > > Signed-off-by: Scott Wood > > --- > > kernel/sched/core.c | 7 ++++--- > > kernel/sched/fair.c | 45 ++++++++++++++++---------------------------- > > kernel/sched/sched.h | 6 ++---- > > 3 files changed, 22 insertions(+), 36 deletions(-) > > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index 9a2fbf98fd6f..0294beb8d16c 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -3241,6 +3241,10 @@ static struct rq *finish_task_switch(struct task_struct *prev) > > } > > > > tick_nohz_task_switch(); > > + > > + if (is_idle_task(current)) > > + newidle_balance(); > > + > > This means we must go through a switch_to(idle) before figuring out we > could've switched to a CFS task, and do it then. I'm curious to see the > performance impact of that. Also, if you move it this late, this is entirely the wrong place. If you do it after the context switch either use the balance_callback or put it in the idle path. But what Valentin said; this needs a fair bit of support, the whole reason we've never done this is to avoid that double context switch...