Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1304295pxa; Thu, 20 Aug 2020 07:58:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+gTjShAN/9KhEUHSXKbfJOlm2tQCzTZKnL7pvC4Io2gjyX5EPrMTwLhV1mfjlx/mwO6Us X-Received: by 2002:a50:9e4c:: with SMTP id z70mr3146431ede.384.1597935517459; Thu, 20 Aug 2020 07:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597935517; cv=none; d=google.com; s=arc-20160816; b=ffVmedhno36gZOokFXBimUREHeatDKHRNfs0QDnrye7/vqRI6jv1z5ymW5M3qh87wu q+VeXSivIUvpuTztoidD3aFzEC7BFVLepRlnAoe24nsQfFUKHPZLAyVtzfkzSoc8Ym80 kKYf67yVYy7ZHDWwt0DV/ap8MoZctcW1IOoXBJN5zYDTsV5sEuTysaL82dGthL14nOwK yuAa7I4cbMzgmlPgP83KNiSnrJibz8hMruko8mN/hr8FkaDmr8FJYIAA6FhGzevRsMd4 GSdfBeEcpp1H92mR6zhQguhDOfjU7NkDKYpthEicjdsbdJ/lUp+npqrimDXMtNqm1R+6 mhhg== 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:from:references:cc:to:subject; bh=VUuRD66i+WKsJgU+Ix2AVyWVZPc/TGOZlnKx5UOdHx0=; b=cS201mGA/PVnYGLya+pE3dRk7kDxS1Cy6BMBgan6eph1vTCzKbCIBGZQ9BkUwLVcJD zM2WjjwDeb/CfQyqGeLdzD+G3PuON3Lxsd5CilpMPGnVBxftNlO+SJuWQ0XVskkCMJ06 m9a+AkUhXtjbOkHaeBS5xnZm7vE5nq8xlqMwVCi3xGKa3xGIPDM2JjUG/koD7/S/QusA lMvDYFdMZYC4b5Ox8TFXvp41+PDPnkxj2PaQq1fnFQy5NCr/xuyIqaIOxjztnDYAd8Qg W+4Gb2GHTbkzn1c+6TE/VP2mX5Gtyivxq6Z+WTw60sr44/CZUEEU1EwaQxTQ2sSsoPtk 0mKA== ARC-Authentication-Results: i=1; mx.google.com; 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 z1si1365885eji.189.2020.08.20.07.58.12; Thu, 20 Aug 2020 07:58:37 -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; 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 S1727103AbgHTO43 (ORCPT + 99 others); Thu, 20 Aug 2020 10:56:29 -0400 Received: from foss.arm.com ([217.140.110.172]:40566 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727090AbgHTO41 (ORCPT ); Thu, 20 Aug 2020 10:56:27 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1B64331B; Thu, 20 Aug 2020 07:56:26 -0700 (PDT) Received: from [192.168.178.2] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3F99D3F6CF; Thu, 20 Aug 2020 07:56:20 -0700 (PDT) Subject: Re: CFS flat runqueue proposal fixes/update To: Rik van Riel , Peter Zijlstra Cc: Paul Turner , "vincent.guittot" , kernel-team@fb.com, "linux-kernel@vger.kernel.org" , "dietmar.eggeman" References: <1609106d05a6a4a5938233e993548510f599d7d9.camel@surriel.com> From: Dietmar Eggemann Message-ID: <0e7a9174-6ed9-752d-dacb-4dce182852cf@arm.com> Date: Thu, 20 Aug 2020 16:56:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1609106d05a6a4a5938233e993548510f599d7d9.camel@surriel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rik, On 31/07/2020 09:42, Rik van Riel wrote: [...] > Lets revisit the hierarchy from above, and assign priorities > to the cgroups, with the fixed point one being 1000. Lets > say cgroups A, A1, and B have priority 1000, while cgroup > A2 has priority 1. > > /\ > / \ > A B > / \ \ > A1 A2 t3 > / \ > t1 t2 > > One consequence of this is that when t1, t2, and t3 each > get a time slice, the vruntime of tasks t1 and t3 advances > at roughly the same speed as the clock time, while the > vruntime of task t2 advances 1000x faster. > > This is fine if all three tasks continue to be runnable, > since t1, t2 and t3 each get their fair share of CPU time. > > However, if t1 goes to sleep, t2 is the only thing running > inside cgroup A, which has the same priority as cgroup B, > and tasks t2 and t3 should be getting the same amount of > CPU time. > > They eventually will, but not before task t3 has used up > enough CPU time to catch up with the enormous vruntime > advance that t2 just suffered. > > That needs to be fixed, to get near-immediate convergence, > and not convergence after some unknown (potentially long) > period of time. I'm trying to understand this issue in detail ... Since t1 and t2 are single tasks in A1 and A2, this taskgroup level shouldn't matter for tick preemption after t1 went to sleep? check_preempt_tick() is only invoked for 'cfs_rq->nr_running > 1' from entity_tick(). IMHO, tick preemption is handled between A and B and since they have the same cpu.weight (cpu.shares) t2 and t3 get the same time slice after t1 went to sleep. I think that here tick preemption happens in the 'if (delta_exec > ideal_runtime)' condition w/ delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime. Did I miss anything? [...]