Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp502003imm; Wed, 19 Sep 2018 02:24:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaupnC5HBtMMDhXBQ06R+NWQVXQ3HHm+cvvBF4Wn/y6ZA7/Npe4GYcNI0YeefmnhC1pJZxe X-Received: by 2002:a63:586:: with SMTP id 128-v6mr31751178pgf.169.1537349053254; Wed, 19 Sep 2018 02:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537349053; cv=none; d=google.com; s=arc-20160816; b=f9Ts+8dMQRQLNjU43R0yrSgrRiplt42dFqJI18Iqef1rUJdYaIo0M6/dckGEpfJkYu JurB6mfSJjk4qKePVuggxXLwXvpJbPM25COyxcCc0nkBswSKS/NgJTHgNNsRVm6d/FXj m2DYs/YNLnVGMZfutYmaEu4c13FACgvUA10CT5+TOm4nfrEz8g2H2fETOXjaVY1fa9uS uNBwFgojYCSiEKIM2vpekcfUUwtooyINspjqbbA02DzxzR938izvyPdJrBRIy5yAe1Eu /fGPmgdMz7J7XJfF8aAbCUoYRfOSuCaiVt2A0hWC6Ep32xNdprK09oXkp88iRc/A5Lf/ BLiA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:references:cc:to:subject:from:dkim-signature; bh=mc/do7kRgrPVycZMQlIfIAg6pRqidsaus1azdPvilJo=; b=sNTOaUInN+fN0/2quoII4ULIj8gkiPREQUJ59yjeG4REijaTYBMIfqiWEFEUTg3lno b+cMBPx2E3CP5+O5/Vpo1KQcgvar1wPwUga6VTr4r7IfIJR1uN7NuaRK4JF0w4hYwLcG MzJs92gsrHUq0KpltfZNP586sBBjT6v99wCbw9kjf2Mhiej9o80N98ZfAt0tOZzF+3Ur Vep5dz00Xy5QRUam4uOpBXWZVdGtUMMaydX2JywzrkvghAzM7q4khJnElaMoZD5L9oOr RYLZ7bwXAjFjnlSxnemfIpabK3NAEvl11q9ZMk0pVZWKP3XLNzmiVs/qvQNYM3fP1N17 ktPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=FadSqIQI; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7-v6si20121306plz.353.2018.09.19.02.23.57; Wed, 19 Sep 2018 02:24:13 -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; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=FadSqIQI; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730984AbeISPAf (ORCPT + 99 others); Wed, 19 Sep 2018 11:00:35 -0400 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:53886 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727056AbeISPAf (ORCPT ); Wed, 19 Sep 2018 11:00:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1537349014; x=1568885014; h=from:subject:to:cc:references:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=mc/do7kRgrPVycZMQlIfIAg6pRqidsaus1azdPvilJo=; b=FadSqIQIUmimDFi4tXsEPYRT5yBA7qd9nKIMdIL+gp7nqec6HW71PJq6 LYspym0rbDj8zF0pQn60ysqlMMwCuyAq4Im1OVFFVN5SU7bGc0jpjPDFQ i4kSkWErUu9Nzwh3D7/vG7os+Ug7G5SzsRsprsGfIX9N+pGXvAA0oMK0F s=; X-IronPort-AV: E=Sophos;i="5.53,393,1531785600"; d="scan'208";a="698134040" Received: from iad6-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1a-715bee71.us-east-1.amazon.com) ([10.124.125.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 19 Sep 2018 09:23:33 +0000 Received: from u7588a65da6b65f.ant.amazon.com (iad7-ws-svc-lb50-vlan2.amazon.com [10.0.93.210]) by email-inbound-relay-1a-715bee71.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id w8J9NQ7O069181 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 19 Sep 2018 09:23:29 GMT Received: from u7588a65da6b65f.ant.amazon.com (localhost [127.0.0.1]) by u7588a65da6b65f.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTP id w8J9NMxi005781; Wed, 19 Sep 2018 11:23:23 +0200 From: "=?UTF-8?Q?Jan_H._Sch=c3=b6nherr?=" Subject: Re: Task group cleanups and optimizations (was: Re: [RFC 00/60] Coscheduling for Linux) To: Rik van Riel , Peter Zijlstra Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Paul Turner , Vincent Guittot , Morten Rasmussen , Tim Chen References: <20180907214047.26914-1-jschoenh@amazon.de> <20180914111251.GC24106@hirez.programming.kicks-ass.net> <1d86f497-9fef-0b19-50d6-d46ef1c0bffa@amazon.de> <282230fe-b8de-01f9-c19b-6070717ba5f8@amazon.de> <20180917094844.GR24124@hirez.programming.kicks-ass.net> <08b930d9-7ffe-7df3-ab35-e7b58073e489@amazon.de> Openpgp: preference=signencrypt Message-ID: Date: Wed, 19 Sep 2018 11:23:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/18/2018 04:35 PM, Rik van Riel wrote: > On Tue, 2018-09-18 at 15:22 +0200, Jan H. Schönherr wrote: [...] > Task priorities in a flat runqueue are relatively straightforward, with > vruntime scaling just like done for nice levels, but I have to admit > that throttled groups provide a challenge. Do you know/have an idea how the flat approach would further skew the approximations currently done in calc_group_shares()/calc_group_runnable()? With the nested hierarchy the (shared) task group SE is updated whenever something changes. With the flat approach, you'd only be able to update a task SE, when you have to touch the task anyway. Just from thinking briefly about it, it feels like values would be out of date for longer periods of time. >> However, the only efficient way that I can currently think of, is a >> hybrid model between the "full nesting" that is currently there, and >> the "no nesting" you were describing above. >> >> It would flatten all task groups that do not actively contribute some >> function, which would be all task groups purely for accounting >> purposes and those for *unthrottled* CFS hierarchies (and those for >> coscheduling that contain exactly one SE in a runqueue). The nesting >> would still be kept for *throttled* hierarchies (and the coscheduling >> stuff). (And if you wouldn't have mentioned a way to get rid of >> nesting completely, I would have kept a single level of nesting for >> accounting purposes as well.) >> >> This would allow us to lazily dequeue SEs that have run out of >> bandwidth when we encounter them, and already enqueue them in the >> nested task group (whose SE is not enqueued at the moment). That way, >> it's still a O(1) operation to re-enable all tasks, once runtime is >> available again. And O(1) to throttle a repeat offender. > > I suspect most systems will have a number of runnable tasks no larger > than the number of CPUs most of the time. > > That makes "re-enable all the tasks" often equivalent to "re-enable one > task". > > Can we handle the re-enabling (or waking up!) of one task almost as fast > as we can without the cpu controller? We could start by transparently special-casing the "just one SE in a runqueue" case, where that single SE is enqueued directly into the next parent, and everything falls back to nesting, the moment a second SE pops up. That might allow reaping the benefits for many cases without hurting other cases. It's also more a gradual conversion of code. Regards Jan