Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp397084ybz; Wed, 29 Apr 2020 02:10:39 -0700 (PDT) X-Google-Smtp-Source: APiQypJpu1LFcnyMdm0SMPxsDM0N0ocETA8oi028YOGHM/QZKHeBQHjyEOlxxkdhGdqInhF6ec+G X-Received: by 2002:a17:906:af67:: with SMTP id os7mr1618263ejb.182.1588151439065; Wed, 29 Apr 2020 02:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588151439; cv=none; d=google.com; s=arc-20160816; b=bpvLCdhUqRuHQW1MEpFjPHIZpzXeHKhxRN389LDStrFcfMDv7ADO4ib3+1/OstWZkZ C3CwgN5/iHGRAZqP4mnrskjpYvrMgsB2HMOmcFTIqz21LYvMZGJoqcXn1rNeNyH5ctmy Y80ptE4/HsbRArYaRAHmUEzrAkNjsNQsbQhsdPWvragTxb+WODjthNEH+uGAuHRGPvm5 0Xqygwz+R5cLEV/UZEjkxXc1YSTtKRz+U8R+T3Fxv6xo1ElBh/s8Zv0flvrKoARY7NPs sukvv0NwGg/WW2XbP1stmneklwv7Do4gkylL5kpiIb03U86Oybjf+A/5NJ9GwpHHZx0v Mziw== 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=XlD1+AvJfZeuuQwUQ9zHNy+2swxAxqsHpj/K9yi6CiM=; b=lkFul6wGKFO7SvF997tm5O0xcuY63LXiO1U+CQ7owR3cPXbqniLJ7Iw9iKA0RstaYX oJmAc+V3SmvSsNqsFZrEKr4cz36luJA5vsULB8MuK6BajvkpeknljJKss7ZGPWSjW90K 3GwQMFb0TFW9OoJH6WFG/H1kb7F+Q44cb/0Ay/8ynozdcfhuCXJrzCaGNyC94xrnGoEm RYyg865Zp9Kc0BP65F/VAuTZm4IaCXCe9eRpGZ6glxINtqLuhf62ymIe4qarARC4bHej LUkZyGiF0YawRUVxN5X0qr6IXPSWs/VI+wL0qAP8xQcdDoJNhu2xr18AHGP7QdsHP7n0 M7ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EZpoaZAf; 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 v26si3565926eje.322.2020.04.29.02.10.15; Wed, 29 Apr 2020 02:10:39 -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=EZpoaZAf; 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 S1726739AbgD2JF6 (ORCPT + 99 others); Wed, 29 Apr 2020 05:05:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726423AbgD2JF5 (ORCPT ); Wed, 29 Apr 2020 05:05:57 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01D34C03C1AD; Wed, 29 Apr 2020 02:05:58 -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=XlD1+AvJfZeuuQwUQ9zHNy+2swxAxqsHpj/K9yi6CiM=; b=EZpoaZAfMPr1EACN+PajqhaSMa 6B0TPq9Ch62/wPf1hf+KHHNPAjStZHmGqTBzAP1qzVyAJboFPqCyLv6cRXhfX2YCrLmSpxSDrokhK kVExjadPyagDkJ/pkzcULs7cUtnrAPixDNbfiVN5vpJlGRWtja8dDJNNJI+cZko5DHLZDu4+J+IJO RZf/SpXptIWWbZvahGcVJgLX/ny8hlX2l+p+6Bpjr4KAwQD9pmr+uhcVN28FFB3Z2oCGxJcXMF8nF sZ6/4kUQ7QBcpptD6auavUCnnapT2ZYp4bY832A3++ccW/O4fqAFHpQ+2ujqaHar90mh3Oc669/Op ndRGfKqA==; 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 1jTieu-0008JI-C1; Wed, 29 Apr 2020 09:05:36 +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 A9CB7300130; Wed, 29 Apr 2020 11:05:33 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 784EC20BD8FF8; Wed, 29 Apr 2020 11:05:33 +0200 (CEST) Date: Wed, 29 Apr 2020 11:05:33 +0200 From: Peter Zijlstra To: Scott Wood Cc: Valentin Schneider , 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: <20200429090533.GH13592@hirez.programming.kicks-ass.net> References: <20200428050242.17717-1-swood@redhat.com> <20200428050242.17717-2-swood@redhat.com> <20200428220917.GB16027@hirez.programming.kicks-ass.net> <20200428230204.GE16027@hirez.programming.kicks-ass.net> <89043649a64fc97dd90eb25c85bcc8f65483cf4f.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <89043649a64fc97dd90eb25c85bcc8f65483cf4f.camel@redhat.com> 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 06:20:32PM -0500, Scott Wood wrote: > On Wed, 2020-04-29 at 01:02 +0200, Peter Zijlstra wrote: > > On Tue, Apr 28, 2020 at 05:55:03PM -0500, Scott Wood wrote: > > > On Wed, 2020-04-29 at 00:09 +0200, Peter Zijlstra wrote: > > > > 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... > > > > > > > > > > balance_callback() enters with the rq lock held but BH not separately > > > > BH? softirqs you mean? Pray tell more. > > In https://lore.kernel.org/lkml/5122CD9C.9070702@oracle.com/ the need to > keep softirqs disabled during rebalance was brought up, but simply wrapping > the lock dropping in local_bh_enable()/local_bh_disable() meant that > local_bh_enable() would be called with interrupts disabled, which isn't > allowed. That thread, nor your explanation make any sense -- why do we care about softirqs?, nor do I see how placing it in finish_task_switch() helps with any of this. > > > disabled, which interferes with the ability to enable interrupts but not > > > BH. > > > It also gets called from rt_mutex_setprio() and __sched_setscheduler(), > > > and > > > I didn't want the caller of those to be stuck with the latency. > > > > You're not reading it right. > > Could you elaborate? If you were to do a queue_balance_callback() from somewhere in the pick_next_task() machinery, then the balance_callback() at the end of __schedule() would run it, and it'd be gone. How would rt_mutex_setprio() / __sched_setscheduler() be affected?