From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A84AC433F5 for ; Tue, 11 Jan 2022 11:59:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9761D6B0074; Tue, 11 Jan 2022 06:59:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 925FA6B0075; Tue, 11 Jan 2022 06:59:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 814CD6B0078; Tue, 11 Jan 2022 06:59:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0026.hostedemail.com [216.40.44.26]) by kanga.kvack.org (Postfix) with ESMTP id 6F94D6B0074 for ; Tue, 11 Jan 2022 06:59:19 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1CB208248D52 for ; Tue, 11 Jan 2022 11:59:19 +0000 (UTC) X-FDA: 79017860838.19.5374672 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf14.hostedemail.com (Postfix) with ESMTP id 5E2BE100007 for ; Tue, 11 Jan 2022 11:59:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=L90dZXr+DchG0EERWhDGtHsJnyZXsrxTqBwOQGncg8Q=; b=SoTdUUyLlm0b3pZIpOMczUxg/U xJbtK0g+lu8BnWTD214WLoFzAQKb9gxtskfxFKvLcXy/J3ww+3uMdEDygFIA1epmBjKtSy8Hs85ef cNAfn+nm8dMuuOAzB5oRHc4+JgVJUpODgEfHI8npUAQNIy7rnRgf+OpHn9agoozCFC+0ZovL1vcP2 9Xkuo0ZEy/cHKGNwt3GaA4fFE60C+lK3kvQjN+1Zl+XOy52ODKcFEKA3VMMv4pMpLC7UQep2R8auq Xw+1/sNbQmmr2In80BNcSG0MrBHplHV3Yx9T3L5RF7nnlw7zF07qsrKCoZNM2/gBfu1lvG1O3rh+P f58fiK8g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7Fnj-003DIw-Ch; Tue, 11 Jan 2022 11:58:55 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 6ABDC3002C5; Tue, 11 Jan 2022 12:58:53 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 25934203E80F6; Tue, 11 Jan 2022 12:58:53 +0100 (CET) Date: Tue, 11 Jan 2022 12:58:53 +0100 From: Peter Zijlstra To: Daniel Jordan Cc: Alexander Duyck , Alex Williamson , Andrew Morton , Ben Segall , Cornelia Huck , Dan Williams , Dave Hansen , Dietmar Eggemann , Herbert Xu , Ingo Molnar , Jason Gunthorpe , Johannes Weiner , Josh Triplett , Michal Hocko , Nico Pache , Pasha Tatashin , Steffen Klassert , Steve Sistare , Tejun Heo , Tim Chen , Vincent Guittot , linux-mm@kvack.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: [RFC 15/16] sched/fair: Account kthread runtime debt for CFS bandwidth Message-ID: References: <20220106004656.126790-1-daniel.m.jordan@oracle.com> <20220106004656.126790-16-daniel.m.jordan@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220106004656.126790-16-daniel.m.jordan@oracle.com> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5E2BE100007 X-Stat-Signature: 9nrm6dsth7rc54sigsw1ydcz6d68gro9 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=SoTdUUyL; spf=none (imf14.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none X-HE-Tag: 1641902358-378620 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jan 05, 2022 at 07:46:55PM -0500, Daniel Jordan wrote: > As before, helpers in multithreaded jobs don't honor the main thread's > CFS bandwidth limits, which could lead to the group exceeding its quota. > > Fix it by having helpers remote charge their CPU time to the main > thread's task group. A helper calls a pair of new interfaces > cpu_cgroup_remote_begin() and cpu_cgroup_remote_charge() (see function > header comments) to achieve this. > > This is just supposed to start a discussion, so it's pretty simple. > Once a kthread has finished a remote charging period with > cpu_cgroup_remote_charge(), its runtime is subtracted from the target > task group's runtime (cfs_bandwidth::runtime) and any remainder is saved > as debt (cfs_bandwidth::debt) to pay off in later periods. > > Remote charging tasks aren't throttled when the group reaches its quota, > and a task group doesn't run at all until its debt is completely paid, > but these shortcomings can be addressed if the approach ends up being > taken. > *groan*... and not a single word on why it wouldn't be much better to simply move the task into the relevant cgroup..