Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp106522rdf; Mon, 20 Nov 2023 18:21:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEHpitcxFZXe14+SmNkIvFpbRgZhmgJSowZOhI3kg1Hj1SjyJkyDUrAFRdHt6Uw/45M6l6 X-Received: by 2002:a17:903:32cb:b0:1cf:56b2:3604 with SMTP id i11-20020a17090332cb00b001cf56b23604mr7379751plr.52.1700533308357; Mon, 20 Nov 2023 18:21:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700533308; cv=none; d=google.com; s=arc-20160816; b=Bc4e8FSehKI2uQTny1sotcShupiE4IsJchW/5BVX1beg+W7R0lCUeoLsHhb8uc7PoN 1f0uoEbgUa1KtgLxgvsJlY7cIvidYS6+A6fyH3tKa8xrjNiPHcy7JafdcjIU6Pr9rGha SkNLI1LYB1cGOcDjeeAMv7CWQHX7Fl0BJfc+czJgRaaxW/UA9Y30UQKqwULFd088bxnv uASnXBJdRsWlu42NHOVSVcv9NCSXM82BWMHUVq1Smyg2B7DVoSAmdJu0RDoqSbAAb5Vr C0+HaaYQamjev1CwrFjOtD1DJP461nLu0EpifQkdsm1Zs9ySOeMDnbQq3nfKRR1x+8Bg XX8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KjsBX+MR5oxmbp1wiE3+ToyqwiDJWNw2gjreRjI1M/o=; fh=b8ku7Q1PjQ/rVoVi+r0CFmPuEXDMS0bN/E6f6VVT+Ak=; b=IAS//XmnHdP4oE3AcSVncQgtehI7RJWOdUMeL8EB98vrgH6o2PPFmP+MFPoPfa/yKp ettR9Q76LY+RogwiBNjR+w8cS65jMUL1PaY+wJqo0CnhLpZygF0EekEnThOdM4kydy94 mfAH3YB6YXeI1n3IWq7jSoAna3L7ccvj+kQ/b+izhUhanTn8R1jB+LZWvzpHz9Nvinz/ LymfaUFj3KBgEfnyhfF3qvxZPEM8H5Clyd8nTPNh5Q2a8z0E1fDVx6RzKZY1eIxkHsY9 XSsDH2WWyCw7XJNMDl8IujOnGoPZaCZyHRxHDIiMLz4IomR56Boja5UaGjBcPcFdEvNP 0rNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sxly0vUX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id u5-20020a170903124500b001b82a4d3ea7si9654688plh.249.2023.11.20.18.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 18:21:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Sxly0vUX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 667D28076C86; Mon, 20 Nov 2023 18:21:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232830AbjKUCVc (ORCPT + 99 others); Mon, 20 Nov 2023 21:21:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbjKUCVb (ORCPT ); Mon, 20 Nov 2023 21:21:31 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A0DDCB for ; Mon, 20 Nov 2023 18:21:27 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C44EC433C9; Tue, 21 Nov 2023 02:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700533287; bh=uCIAAso2o2OQwlp0AJVheBQitVA2TVtgsiyQ+Mez97M=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Sxly0vUXgMDBDfLs6ZoxC1suGBtCN9UTkQUnCVmRPm7tnzA9x6u0Mh2J4rYzJ+wj1 ZhOIdNEUs6ZZ0DVck7xZw37dh7+FqE3j5tipC5yE0O0IwRop4ORVosQST+sSNlMIDb b9JWh9ywNem+hqYeFTpyHeFc+bHF5lRjW/vQIstkgG4kLKn03W2YloHjGScCk76uOk AZWBZmKXpCXD39lws8w9g8r/8gifhF/NiEWqDTjZDXdhIeiAMUcgPVITbJaCyHl7vR xoUjUV6tJX3eEXzNc1yMQcjlCN+5335TBdOpqX69bHvAZpnPM8nvzrd0tiMvBIh5oy bJ+b3s9OlvU7Q== Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-1f94b07b6b3so674426fac.2; Mon, 20 Nov 2023 18:21:27 -0800 (PST) X-Gm-Message-State: AOJu0YyJR/fUlY2pSwFO9l5//UPGaW85yDVwfERSGEHu6/yPuAPGjxoU DVKXmQ+FqoVlIkxz5H2IoXs40+PZ/iSeswztad0= X-Received: by 2002:a05:6871:22c9:b0:1f9:48fb:1835 with SMTP id se9-20020a05687122c900b001f948fb1835mr4140629oab.46.1700533286595; Mon, 20 Nov 2023 18:21:26 -0800 (PST) MIME-Version: 1.0 References: <20231115004932.650702-1-ak@linux.intel.com> In-Reply-To: From: Masahiro Yamada Date: Tue, 21 Nov 2023 11:20:50 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] kbuild: Add inline-account tool To: Andi Kleen Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Mon, 20 Nov 2023 18:21:43 -0800 (PST) On Tue, Nov 21, 2023 at 5:08=E2=80=AFAM Andi Kleen wro= te: > > > > > > + sym_sizes =3D [syms[x + 1] - syms[x] for x, _ in enumerate(syms[= :-1])] > > > + sym_total =3D sum(sym_sizes) > > > > > > This is equivalent to > > > > sym_total =3D syms[-1] - syms[0] > > > > isn't it? > > No it's not when there are gaps in the symbols, which always happens in > the kernel. The previous version used the range but that led to inbalanc= es. I do not understand because there is nothing to handle gaps in your code. get_syms() appends only 'pc' into the list. Then, sym_sizes =3D [syms[x + 1] - syms[x] for x, _ in enumerate(syms[:-1])] computes each symbol size by: (address of the next symbol) - (address of the current symbol). So, your code is equivalent to: sym_total =3D syms[-1] - syms[0] > > def get_ranges(syms, threads): > > > > ranges =3D [] > > prev =3D syms[0] > > i =3D 1 > > > > while threads > 0: > > > > boundary =3D prev + 1 + (syms[-1] - prev - 1) // threads > > > > while syms[i] < boundary: > > i +=3D 1 > > > Note the boundary is not the address, but the sum of symbol sizes > > > -Andi -- Best Regards Masahiro Yamada