Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3713116ybz; Mon, 27 Apr 2020 22:04:35 -0700 (PDT) X-Google-Smtp-Source: APiQypIMiS6YPvNFPdlMBjXkaUk+ERj9SK7t+tYShtjuiTOBevX0UxdSRdKhtDfzjRSDa6SjaOE+ X-Received: by 2002:a17:906:7809:: with SMTP id u9mr16717652ejm.233.1588050275761; Mon, 27 Apr 2020 22:04:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588050275; cv=none; d=google.com; s=arc-20160816; b=fhZBEqr9wikWtPhFma3jqULDUnwaWMFiWRRJvCxs8aaiYswQRiXbxvo9y4o5x44Ten zNhBe2IPhIbUs6pY3sDY38EoIAhkCgAC8CW5HaRf4RBUDd+miG0b+N8RugZNpExy/+KX pcdt6sRRoaeA6ekp81XTHgZZ5TWeU8+m94PiZqMYpKR4sgcdJc2iNVhBPL+s3Tpg/YiP RDnPeO516cblAki8Osbp0OmwLX6Xi6r72Pxzd0FIV6BOaKWh6YmfpB8e74uscj+4W0rl 4XrDbc2i29bAwyNCUFLaX2Xx5THmd9KeK/HW+s3etvwE1aPlaV9JNgi/gD7JKU0HEZ29 YumA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aKCNIcVoG7r+R/o+L3JV6BX0afKeSbXEAsVJ13PnLAQ=; b=cSR8AZiDheWZE2p+pfbK2qcUEcbabmJXXXPyJGzzk1goU8tNnaMZLiKMAqo6n+KEIQ 91JXOnY2YiumxbACAjgu92qRhQqi6aU4xzuRTUecLoENwwq8KmvZ8+V+m/LQndbkPgw9 4I0ByMmX9lm5ffsKmFVveFY8ldwQEgET6L0pohDK8Gl/mpQTLdo3MzldACx9SHjCEoEx V3FLYUam1B9ikONM9hk4hAhbXmj8VxuCGb2bqERRoocEZNoBj9iy0xJgD8Dc4TGwQVFP Y1h3GgJZGnpaA0liEOPw1LmiH6K08tgF5lUXEsGN//3v1A1dXYFPAXjSCEllde3wOZ9L A9Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ONJ/emjM"; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz11si1173693ejc.50.2020.04.27.22.04.13; Mon, 27 Apr 2020 22:04:35 -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=@redhat.com header.s=mimecast20190719 header.b="ONJ/emjM"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726350AbgD1FCy (ORCPT + 99 others); Tue, 28 Apr 2020 01:02:54 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:31129 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726318AbgD1FCx (ORCPT ); Tue, 28 Apr 2020 01:02:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588050172; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=aKCNIcVoG7r+R/o+L3JV6BX0afKeSbXEAsVJ13PnLAQ=; b=ONJ/emjMqcMB5slKQri2KgZzw9RYlVOGklpz/E2a/NTwSt1yPLqD7uuH/uweryIKcsGSY+ jNDRaC+eyULOvHGUvEA7oYIH56LDj/tAmvPw5+WJYT7xCD3UA9ydsPhqH3pCxPoP4gG2Wq PelLv9M82MprVHcRcDkbQb8euyian6c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-246-4Ay0BtX0MTO1xH0QuGjMDw-1; Tue, 28 Apr 2020 01:02:48 -0400 X-MC-Unique: 4Ay0BtX0MTO1xH0QuGjMDw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4FB201895A2B; Tue, 28 Apr 2020 05:02:45 +0000 (UTC) Received: from t460p.redhat.com (ovpn-112-24.phx2.redhat.com [10.3.112.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5816E19C4F; Tue, 28 Apr 2020 05:02:43 +0000 (UTC) From: Scott Wood To: Steven Rostedt , Ingo Molnar , Peter Zijlstra , Vincent Guittot Cc: Dietmar Eggemann , Rik van Riel , Mel Gorman , linux-kernel@vger.kernel.org, linux-rt-users Subject: [RFC PATCH 0/3] newidle_balance() latency mitigation Date: Tue, 28 Apr 2020 00:02:39 -0500 Message-Id: <20200428050242.17717-1-swood@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.=20 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 matte= r -- 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? Rik van Riel (1): sched,rt: break out of load balancing if an RT task appears Scott Wood (2): sched/fair: Call newidle_balance() from finish_task_switch() sched/fair: Enable interrupts when dropping lock in newidle_balance() kernel/sched/core.c | 7 +++-- kernel/sched/fair.c | 72 +++++++++++++++++++++++--------------------- kernel/sched/sched.h | 12 +++++--- 3 files changed, 49 insertions(+), 42 deletions(-) --=20 2.18.2