Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1795100ybz; Thu, 30 Apr 2020 05:45:07 -0700 (PDT) X-Google-Smtp-Source: APiQypL07RLqxyYvoFN8XyDq7/K3RyWWOz3JBE+f4zWollVV4AJ3v/Nkhpz0hd9WkTdw79PAJb7p X-Received: by 2002:a05:6402:1a33:: with SMTP id be19mr2540153edb.214.1588250707215; Thu, 30 Apr 2020 05:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588250707; cv=none; d=google.com; s=arc-20160816; b=SGLhvnLJ7HG+cw6bg3Oq+SYyrhm7td2csChUTQ50bE/B34PtB5bzovDtBeY6S5VoSP +EsXikyXO2jvxpt3BNmzfPzpTbfTCoLrXUe/iR6VfEvVZYmsZVcXuLOkeRoBqPNjwrZ/ mnD/2YRNIBCNptWeMM2f0YSi77UeIkRuoXKgRdk7Nprr7Qi6bSafQ2TpGuIUlKIIm+0I r78uXmplgxpd90Hm9FJwQNN8ZqYuOflo3IabRP9/+FQ3XCMVRtRAF8nY9pVQtxGQ58kS DtG0GheUmVUQZRddtrmF2py4U4LmKVTTsAbJLBio/9EEfn+gwb4VQRlzCOHNxlxoddtn LSbA== 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=yumFUMI4249WSXzPR5V8YGUqtmGI9DD0x2OLnA0cDLs=; b=qtdVlvpnShOcazEJ1K978ltbgkLodbor11M2ypB1wW5/Xe/1Rd/p11hS0bwp6Uy1vl 9vvnoxTTEf7sI0cUEJ7MORZk7edtcNIVwiYvr9cs854FyM3or/2nk1Uq2ZqUu3Kl+MoM Hmo7zZqek3DC5tMDp9qhaFdXTBeNauNxigFjmw01TC6b+yTeC9Mbo74hgkZwgcJpMfvy 795iQbjOthgqqUrscNV+kJOEZaiXUDD575oYBw3YSqGZC6/MzfMPiL41yPSPcqW8kP6m D0sPfUcC621Qhto8jEj+m5zmk3xeWE7kjdPz6bunMZSy4ZBmi9xwDAy3/ba1B9auUozr 3HMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KdDsdhzG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si5431621edf.299.2020.04.30.05.44.44; Thu, 30 Apr 2020 05:45:07 -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=pass header.i=@linaro.org header.s=google header.b=KdDsdhzG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726743AbgD3MnE (ORCPT + 99 others); Thu, 30 Apr 2020 08:43:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726520AbgD3MnD (ORCPT ); Thu, 30 Apr 2020 08:43:03 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E87B9C035494 for ; Thu, 30 Apr 2020 05:43:02 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id g10so1067386lfj.13 for ; Thu, 30 Apr 2020 05:43:02 -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=yumFUMI4249WSXzPR5V8YGUqtmGI9DD0x2OLnA0cDLs=; b=KdDsdhzGLrYgimJfZZEx2eF9JO3+vXrJDCCyg2oLnXyV21m1T5GaQnN9reCiJZLVeU SFS+4h4iZ3hVadXJCwKLrbUOBvVEP8R0kSWGduLVKwuQeNAzrHW76gFSq0HwXyd/L8V9 /GfHGAaHyBl7SO2CWZqNCVw7ogKQ6cUYCtq+1+xSTHDhjefdtltnpdNrxTK961Kf1T7j O2qsrBiIKIeUWxrIME5UQ0zDVN36ratrdn7Nxq7HmPJV51QZXoABVzTf5xxb1jRLDF7h lQGM7JTRIsFXKDn7jTV+XFm5+oQRHIU8q7tZw+RIPO0+BsOQOAqhcJ0lOmTNB0Gthear Z1yA== 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=yumFUMI4249WSXzPR5V8YGUqtmGI9DD0x2OLnA0cDLs=; b=QtvFIaXPYZ6/jChqLx7UBavNi2KYtiQ3iF0AuGdmvSxEA3+p0znTxAdGFyQ8HSx/8U X5QQg3tpT2TY9Qy5z5tbiPrZfm/8AITeiWDqz+sscymbX81FEm//6xfxagjE3m4HF9BP Mdc4EtIh4jvZPvYhyNluca9j/9OxiJx4UeyqPC3pmFul2hN9xfWypNDSP2dilpd/bOUY felM0AJAXuEVVH0G2XKZkFYb6pD7TGfZfG7U0i/BYV/oPvzZII826zZAYpkFRFQTrols gYmMWxBXoQu2e2V4ymNG/8chFyL/valLaSE211HjeTkPxfCx+TGMME+Aha0XDTWp2Bp2 Xs9A== X-Gm-Message-State: AGi0PuZsAYzChAYoi54cyVRXvUapG+vT9weqVx3xqYQn/Ynud81MwTG2 wJ2mDhKh5cLl7U66uy7l1RyM+zV92kR+Jec5rnA+Kg== X-Received: by 2002:ac2:5e65:: with SMTP id a5mr2039989lfr.189.1588250581343; Thu, 30 Apr 2020 05:43:01 -0700 (PDT) MIME-Version: 1.0 References: <20200428050242.17717-1-swood@redhat.com> In-Reply-To: From: Vincent Guittot Date: Thu, 30 Apr 2020 14:42:50 +0200 Message-ID: Subject: Re: [RFC PATCH 0/3] newidle_balance() latency mitigation To: Valentin Schneider Cc: Scott Wood , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Dietmar Eggemann , Rik van Riel , Mel Gorman , linux-kernel , linux-rt-users 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, 30 Apr 2020 at 12:14, Valentin Schneider wrote: > > > On 30/04/20 08:44, Vincent Guittot wrote: > > On Thu, 30 Apr 2020 at 01:13, Valentin Schneider > > wrote: > >> > >> > >> On 28/04/20 06:02, Scott Wood wrote: > >> > These patches mitigate latency caused by newidle_balance() on large > >> > systems, by enabling interrupts when the lock is dropped, and exiting > >> > early at various points if an RT task is runnable on the current CPU. > >> > > >> > When applied to an RT kernel on a 72-core machine (2 threads per core), I > >> > saw significant reductions in latency as reported by rteval -- from > >> > over 500us to around 160us with hyperthreading disabled, and from > >> > over 1400us to around 380us with hyperthreading enabled. > >> > > >> > This isn't the first time something like this has been tried: > >> > https://lore.kernel.org/lkml/20121222003019.433916240@goodmis.org/ > >> > That attempt ended up being reverted: > >> > https://lore.kernel.org/lkml/5122CD9C.9070702@oracle.com/ > >> > > >> > The problem in that case was the failure to keep BH disabled, and the > >> > difficulty of fixing that when called from the post_schedule() hook. > >> > This patchset uses finish_task_switch() to call newidle_balance(), which > >> > enters in non-atomic context so we have full control over what we disable > >> > and when. > >> > > >> > There was a note at the end about wanting further discussion on the matter -- > >> > does anyone remember if that ever happened and what the conclusion was? > >> > Are there any other issues with enabling interrupts here and/or moving > >> > the newidle_balance() call? > >> > > >> > >> Random thought that just occurred to me; in the grand scheme of things, > >> with something in the same spirit as task-stealing (i.e. don't bother with > >> a full fledged balance at newidle, just pick one spare task somewhere), > >> none of this would be required. > > > > newly idle load balance already stops after picking 1 task > > Mph, I had already forgotten your changes there. Is that really always the > case for newidle? In e.g. the busiest->group_type == group_fully_busy case, > I think we can pull more than one task. for newly_idle load balance, detach_tasks stops after finding 1 suitable task > > > Now if your proposal is to pick one random task on one random cpu, I'm > > clearly not sure that's a good idea > > > > IIRC Steve's implementation was to "simply" pull one task from any CPU > within the LLC domain that had > 1 runnable tasks. I quite like this since > picking any one task is almost always better than switching to the idle > task, but it wasn't a complete newidle_balance() replacement just yet. > > > > >> > >> Sadly I don't think anyone has been looking at it any recently.