Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1008048lqd; Thu, 25 Apr 2024 03:25:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWDtsnvLOEnvWRBmLf1JEGl1pAv+7GRZyJZNLzZVlgaTG3E6OhNYDVUNz0KJDHUlsJ9ClZIOH+DSDd8H6V037un7xnouU3Qq9Jju5Yjkg== X-Google-Smtp-Source: AGHT+IG7rp9jdvpf9nOWLf1iPUWpYB0/RfkJFiANE9p9CKImkIO/4A5H+D1y6Z8Bnc6ltUizvZ7K X-Received: by 2002:a05:620a:b8f:b0:78e:ebcc:797d with SMTP id k15-20020a05620a0b8f00b0078eebcc797dmr5561974qkh.78.1714040739315; Thu, 25 Apr 2024 03:25:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714040739; cv=pass; d=google.com; s=arc-20160816; b=GyE0/et7ADKzuaMipWPjhetCsta6LNzMjnktHIeoxw8NbIkFy3Xwxg1WMfu+H9osHb lnHHKUB5T9b7G1YrQMqPzYU09VR0+eXW6Hbc4zBgD+h8iqs6PGGzj/9AyD/lagnmMvdV Xu6gKCBSiTh2wMIf/Fst2MwA1LH9KOgw3CcParXb8G8iyNYrzEjdWKSGbm8XcGeewF+5 skcBC0SDd2Xdn9I6qloNJzgbsheTBco0Fs4rWu/g+pGyjIqNHE/Y3YEJutTkMNtY6wmr Nxwr9aTcK29ZgClKWQ6n7aSnwnQYUzOV+cqFljcFbA1pwfLkaz/KYxWBv7e1jhyNc4So d+Tg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IINbEFON+HPYGGTEXA55gchXBYnchVeuFDrlPk0d1qA=; fh=wlVPqfvUM8JPaPxBn+u9DvSeTpor7iK/l0kqOQHx26c=; b=YvSGfAcTTXaZQKScyV/Kg6+n6GvR/q3G4Prri2UQwJ+nmAzPG7L16lmzp8kT0MEoXU gsOBWL3227vuRLf3u7nuWPxGpnaJ/ATeMFGK+8s4N6+BNEbiXSsmIWDX5bO0VjWhs1HT dfsNNYJtIgLT3daJO2rlAnHMZUYt0Q4WUeW7oM+fk8byyS44rGPAzpceHnr6Lt4Rr8R2 TNwT87Gq3eKHnzCG/Ln1IKrwlpj81lmt1iCXXcq9tNp/BzEpQFCQwhJwWayfyEjBpQOQ Yvhq5YiEI0lQNgniNQhoYNjDdGoyEglv6HtnvpCMr2LvsPwyPqSU1YARPmlPhTKEPZyX Nmhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=UapVWm1f; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-158387-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158387-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v12-20020a05620a0a8c00b0078d6b4b06e7si17428144qkg.64.2024.04.25.03.25.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 03:25:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158387-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=UapVWm1f; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-158387-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158387-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C09861C21924 for ; Thu, 25 Apr 2024 10:25:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E0368663A; Thu, 25 Apr 2024 10:25:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="UapVWm1f" Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0060781AC6 for ; Thu, 25 Apr 2024 10:25:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714040733; cv=none; b=OH6q2zsqQfQNxzYIMQr/2ch1ZuYFaMHCxMNwJZU6IhYA5fV1sgrAFzRciIAbpQbYDxCWkminstiSj6jryiv5T+gR7r59GBB9ieRFTOxWBT3pwr3Qgw3sm8LeEjd71+vgTlVPawVwh+ZoM5AdSnVnF4uvl9Ejsrzp5QhqpWkgA90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714040733; c=relaxed/simple; bh=nQ6BAMEjWN+AZKKlyNuNYNVscajVEm4QpeRWXj6TSmM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oA01dHy+OHXSHsNNEtSKfRwCM2SoRvXSepP13AJytBrmpsgEKmU/YF+O0rdumRi4x1iAS75AUT8NX/1mmSsK14/ab7oMxqAR9gYWYWU6qLMpvfsI/MqOV305i9M7GhvIE3BGj3zWN2EswRGznv4rrkoj7NQ3G6sOJNWvBL2yV+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=UapVWm1f; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=IINbEFON+HPYGGTEXA55gchXBYnchVeuFDrlPk0d1qA=; b=UapVWm1fsTF2w8v1NdTh/Nwmo3 FHYR43hKf1TpVf+sWpyiijbviWiWN99ssDosbTZP1WJACA7iLkdigrTAA76CpligOA18/xaSB6iU/ 3mHF6RJPnvrD092vsE4Frmj4pyyv9+nt4OFhdwijezOHJxcxGBHqDbMX4bET6Nb3PgoBlxbfkmgWZ hMdW7KmXJNup7XjZbPOf7QJtjRevgw+zjYwZPI+3XQ2jM8N0LINlgPIlekmO7fVEJclm78kzwXAoP jw+q3Ia06Cpc0+oqhRKWtZzzs0GC5jvjeH7rF1dVmTLnvQi4CwecCKAPlqkbpRImoS+R/pvqg9QEu T9EVozJg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzwI1-0000000EpVl-1Vga; Thu, 25 Apr 2024 10:25:17 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 07CA4300439; Thu, 25 Apr 2024 12:25:17 +0200 (CEST) Date: Thu, 25 Apr 2024 12:25:16 +0200 From: Peter Zijlstra To: Yan-Jie Wang Cc: Chen Yu , mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org, kprateek.nayak@amd.com, wuyun.abel@bytedance.com, tglx@linutronix.de, efault@gmx.de, yu.chen.surf@gmail.com Subject: Re: [RFC][PATCH 08/10] sched/fair: Implement delayed dequeue Message-ID: <20240425102516.GD21980@noisy.programming.kicks-ass.net> References: <20240405102754.435410987@infradead.org> <20240405110010.631664251@infradead.org> <20240408090639.GD21904@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Apr 11, 2024 at 09:32:23AM +0800, Yan-Jie Wang wrote: > I have an alternative approach to delayed-dequeue inspired by the original > CFS implementation. > > The idea is to keep the task's vruntime when it goes to sleep. > When the task is woken up, see if the lag is positive at the woken time, if > it is the case, clamp it to 0 by setting vruntime to avg_vruntime(). Problem is that avg_vruntime() can go backwards, eg by dequeueing a negative lag task. This gets really hard to argue about real quick. Keeping the task competing (delaying the dequeue) is by far the simplest solution -- conceptually. The code just became a total mess because of cgroups :/