Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2857327rwb; Sun, 15 Jan 2023 23:53:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXvC37aTib0I8z2Ghg1JqRRpuB46JcMW9IT0zFwh609bPGMyF2alwxSaTQ5VYkunHO6eFg9H X-Received: by 2002:a05:6402:c4c:b0:48f:acd1:8da2 with SMTP id cs12-20020a0564020c4c00b0048facd18da2mr41790973edb.27.1673855612587; Sun, 15 Jan 2023 23:53:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673855612; cv=none; d=google.com; s=arc-20160816; b=KLQ8C5XWm+UsejfIwXR5x7Kqyov+zgV91QsyP7xlGnF2ayxqPaBZhjvZNGmRROao3a iq1nnqWNelyyEys2HtJNFE2w6J++AAPySuRi5zCUFpy9A9HzmHj0uEIWLUL8MrK1cZeT hF3CzZVdVSPZn89y4FfAx6eTai0Cq8Pv6BBz2bW5mCayTXtOuKqoV3Vtl4WN6vae+jCb pasxnMNESe4imh6iO3aDeFT+5BttbRxrFgTGxAiBGECGPpXyeweW5uBgIGzA8W8HRc/W d02Sy5sBKIEvW6paE6Foi6eFSSamB33Bt4IE7laRMC6QQGLVw+zpbPWdE0vgPIXJ3yj8 LdBA== 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=/AHkZm1OuYto89btHGRYiNjjnDO1SMKCfzrD5TaAIh4=; b=IRI0QMGvcRzquFgM1EuD/IHfa6z8zcbMb69pXMfuu14r04UVlqgXerA/JD0gX02u97 2rxImlzfcs4qnm5xKxboCmPOVAQi0zEzavq6ufIGvq0PtIOh4e71gQAzsbB/nYWL7F2m sweLR75xFTSxUVwwnocosMbdsU66rV0/0OtA9va9xafUxlqaxDHWPsvE+czrPgohdC9z sNFd7909m/22OchQO0KnJ/kQtuPF3q8/LPTYoUOOwid0RP7oAGLq1UkheKs7XEqXSKPH +aEeculu7sNs1ldKEm7MWK0qK0v/XgIKlJCA6ECmqC/Dopnz25ydSNAx8CwqEa7rn4+H gfwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m8qsO75d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020aa7d3cf000000b0049e00035769si4730299edr.264.2023.01.15.23.53.20; Sun, 15 Jan 2023 23:53:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m8qsO75d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231824AbjAPHhc (ORCPT + 51 others); Mon, 16 Jan 2023 02:37:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231796AbjAPHh2 (ORCPT ); Mon, 16 Jan 2023 02:37:28 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C563A449C for ; Sun, 15 Jan 2023 23:37:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 30BB8CE0EAF for ; Mon, 16 Jan 2023 07:37:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A505C433EF; Mon, 16 Jan 2023 07:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673854644; bh=Tl6jLwg9ODlFWmZcwhzVGr7C/u1X+6fbamRRbNhBmw8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m8qsO75donOoh2XLqMaXotNJX+0a2mfQExgIP8AZfyfLQq+yD1Pf5CP6Ni/T3XcQh OSVostHbcmVZ+jGtmz48pdlDvQxZ2LUemKCczVSjotUr0/9Jhg45YQVmtKexP9aIxv K9qRj+aTgdwXZjAE8uzkFKmQWsVNA8QhLG3jBQpbvldFXLOBIzIWEG9VN+yDzyz/MV PNIIJ5O1NDAuXhQIvEnCHve3RNz+3DWRvzFsyUojqcZv9mCB1yGfp8fE5/PsdUdCNZ NC2k15EYGjFGsKiaEk+rmQuLfL8LbyvLwIgjmfrsJSqNMCRaUDV4hT69fsKqotbLFU gj5yF0jfEkHvA== Date: Mon, 16 Jan 2023 09:37:13 +0200 From: Mike Rapoport To: Peng Zhang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] memblock: Make finding index faster when modify regions. Message-ID: References: <20230113082659.65276-1-zhangpeng.00@bytedance.com> <20230113082659.65276-3-zhangpeng.00@bytedance.com> 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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Mon, Jan 16, 2023 at 11:17:40AM +0800, Peng Zhang wrote: > > > 在 2023/1/15 22:02, Mike Rapoport 写道: > > Hi, > > > > On Fri, Jan 13, 2023 at 04:26:58PM +0800, Peng Zhang wrote: > > > We can use binary search to find the index to modify regions in > > > memblock_add_range() and memblock_isolate_range(). Because the > > > arrangement of regions is ordered. It may be faster when there are > > > many regions. So implemented a binary search and a new macro to walk > > > regions. > > > > Did you see a measurable speedup with this optimization? > > I'm not in favor of micro-optimizations that complicate code. > > > Thank you for your reply. I haven't measured this patch yet, theoretically > this small optimization might be difficult to observe. > If you think this patch complicates the code, you can ignore this patch. > > These three patches are independent and they can be applied independently. > The logic of the third patch is very simple. It will not complicate the > code. It is tested by the default configuration of qemu. The total number of > iterations of memblock_merge_regions() in the third patch is reduced from > more than one thousand to more than one hundred, this is only in the case of > a small number of regions. Can you consider the third patch? Can you please send the numbers and show how did you obtained them? > Sincerely yours, > Peng. -- Sincerely yours, Mike.