Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1925635rdb; Mon, 9 Oct 2023 07:17:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtQZE61pFZAgS8fMDpeS2XJEaD8u5iCKC+c9R9XBjS86gU9jYWvrFQrk+I6zBkIm4FZi3X X-Received: by 2002:a05:6a20:7345:b0:167:26c4:256d with SMTP id v5-20020a056a20734500b0016726c4256dmr14981810pzc.21.1696861036552; Mon, 09 Oct 2023 07:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696861036; cv=none; d=google.com; s=arc-20160816; b=JODpUBcyi/BnkFfkAJANKkPGvclm9p3WemiDT4dvbM5USbwGJpqlXtkkQK+tjG+gKG EFUQQBkHXAjbwn0Emjw6OHDahtxdcpla7CKTd53HS14jQMrp/cirU7UIdhp06d9NoShS 2STvAYuWBVeIe9F6OyNrf8rXhORq1ZuqochYwwUisuSdMKv7vTY+H+FOXo65ACzahEfK 1vDVRN0MLne2KFWccCBn3X05SK0pUTlWFcfYUoMk0h7RhRYugVRnkPuqrH4h1DFhFIBI F8RQwijaZntSFRGVYkB47WELAsEOLsbFkaFvu2OII3ZBoKRgMMgvMw9LsGUwrr6h2uZz rnlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=X9XLTLzSrjwqlzyAfMOTchqR33f305YkvTKHug96aps=; fh=v/v83w3yRXVx6Zw3G2iB1s8Adj6J8/IaUT/afFw+7Kw=; b=HDwjhz1X1NCkLPSX6JyiRps6+ZzNVnJX//taqIKOTCXL4kvsjmo3TeLpx2ObHsWcBn //gQcIbKIfDbOfD0wphVyl75T3KruGFBywpn9vw1AR2TUf/sF3vmaEL3kRdnbyj6xEsm XF7/2MYk4Y5qBvraGlFt/1jDGd4D6RdWjiNpAaMKdV2flYVSTsPbIeBnlJJ3D4SPHBpu ZyPGpE2lIkh2yly5/GzJBy0NTmElUMNW7vK5MgVUAgAFMjg+EWKD7tW1XM5cup8Y/31O H6eLVTf+UBMGsHwH0rchF8cKQYXyUbJNe4bY141z1IhNgBjc6hKQbMDR/nGUiU9PhFTE TjzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Po2zGgj6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id n12-20020a056a000d4c00b00692dfef1ebdsi7126634pfv.189.2023.10.09.07.17.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 07:17:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Po2zGgj6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A7DCB8029155; Mon, 9 Oct 2023 07:17:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376937AbjJIORL (ORCPT + 99 others); Mon, 9 Oct 2023 10:17:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234088AbjJIORK (ORCPT ); Mon, 9 Oct 2023 10:17:10 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 891C78E for ; Mon, 9 Oct 2023 07:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=X9XLTLzSrjwqlzyAfMOTchqR33f305YkvTKHug96aps=; b=Po2zGgj6vvdInxyeMmC/T+GRJu Jr6beW/uy4QZltBzprXMtEU6Qggv9kuxP0LrmOM7NoqqAHyVMPQontG3wJU7ntYgfKDH7TTyd3iUm xMrqfuXktd5aa4qS9BbiFfIHylIRokPz4mSphzQYdWPQF6rsN+SH/qR+FOQgB8ESLKT1k6h5t71gq nQO/DL14OliW2dgJwnwO1RAjYFcA0N95j5LunN0ZKgSc1YXCG3HJPV4R1twalqTshV17QS+8Pqcm2 KQowCZhTrE8cwp3rFoTqsue7N8hHRgL0NkRLYk+kghNaA/MUDXtAOSxoTAlVZviSLSw1YUQR7X3UK hB4LzeBg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qpr4C-00GI43-QX; Mon, 09 Oct 2023 14:17:05 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 65723300454; Mon, 9 Oct 2023 16:17:04 +0200 (CEST) Date: Mon, 9 Oct 2023 16:17:04 +0200 From: Peter Zijlstra To: brookxu Cc: bsingharora@gmail.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] delayacct: convert task->delays to a object Message-ID: <20231009141704.GE14330@noisy.programming.kicks-ass.net> References: <531ddc82793a39f4c09316d701a4b1170bcad4ab.1696761522.git.chunguang.xu@shopee.com> <20231008105801.GC6320@noisy.programming.kicks-ass.net> <5dba07eb-88f0-bf84-494e-b979f32ad44d@gmail.com> <20231009084341.GA14330@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 09 Oct 2023 07:17:15 -0700 (PDT) On Mon, Oct 09, 2023 at 06:29:15PM +0800, brookxu wrote: > > 在 2023/10/9 16:43, Peter Zijlstra 写道: > > On Sun, Oct 08, 2023 at 07:10:01PM +0800, brookxu wrote: > > > > > > > @@ -1331,7 +1332,7 @@ struct task_struct { > > > > > struct page_frag task_frag; > > > > > #ifdef CONFIG_TASK_DELAY_ACCT > > > > > - struct task_delay_info *delays; > > > > > + struct task_delay_info delays; > > > > > #endif > > > > Yeah, no. > > > Yes, this way will increase about 80 bytes for task_struct, about 0.85% of > > > size of task_struct, I think this just like sched_statistics, so that can > > > better support dynamically enable through sysctl. > > But it's 80 bytes 'nobody' will use. And arguably we should do the same > > with schedstats, that's default disabled and again, that's per-task > > storage nobody ever uses. > > > > Per this argument we can grow task_struct indefinitely until it > > collapses in on itself by the sheer weight of it's information density. > > Every additional field will be a smaller fraction of the total. > > > > Yes, it makes it all a little more cumbersome, but we should really not > > burden everybody with the load of some. > > > > Surely there is another solution... ? > Thanks, agree with you, I try do it in other ways :) One option is to first flip the static key and then iterate all existing tasks, allocating the memory structure. New tasks will get it allocated per the static key, existing tasks will get it allocated per the iteration and dying tasks we don't care about. That would be sufficient, no?