Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp228327rwi; Tue, 25 Oct 2022 23:30:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52DkehiHYHc69wBewxIm8JYtSjwxaWDVw47BS0gXG3Zwj35bo++yC7dnPWqRzyV0/oaN7b X-Received: by 2002:a65:694b:0:b0:43b:f03d:32b0 with SMTP id w11-20020a65694b000000b0043bf03d32b0mr35407203pgq.543.1666765821767; Tue, 25 Oct 2022 23:30:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666765821; cv=none; d=google.com; s=arc-20160816; b=NcIsqXk8aBhLq+wBQty9hjLHesoRx8Bqr1PP0dljnirDTE//Ri0T8IwTF7tVJvpsTu aECW3/dyRtdMjQX07HCDgbffW1kWLoocGxN1HqI6ZAKZ+ejEXXfQ5UvhtB0BI2Uik34/ fSmbW89s4c+O6RnUmqXnCYE1RCPqR6nz87EwCqEK1EkhGbHlmzDOvYTS7XEwfNZNVgZK GG+7Sklxtb3ds+Q0+OhrteN6WiZ6ZHMhnU3OalAe4ApG8ZzrgmUetmxEYdjzFY9mYCzY I+J7VgH6oMeoyQNwc3T1NsQLcKd1Aek6fTTfLmYBeYXkdo4XBxq6TA4v1q9Cjtf4CLe8 /8Zg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tYd0acwIcEv3q+BuJncJ4ARkXaIzBRKynOMy7ZsK2S8=; b=Jpm3l3lJGjJPEtRCPCh0hqsfFsneAzpOEPTbi+vKXJSNQoZTiJALOJD8r4bP6FPv8r f9HuI3me5ImCLe8deO2SAcZ4BXtk4lo3PPeH4cZzy2L25r3xawEZA4HmzSeRNsBf4AQ2 LzoHZ96747avTkXclEL6IM0FOHM5jf/GtlJXSMtnlJKIy2DklhYvSi14eguK3A0fB6fg jvIVQgV/gUNoWrijXnYiFeUEViDyBN1nfN/wEpg3JO3Yh26YbwwKC3G0mNxpY5aYzNj4 xUnqqvhz4i88NehOzVkqaVMOnLpQhe5EZFEO0sFOtXRWSJ5grGAAJ8vxk7uEJHZUATBq 07og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rnTWDXJ0; 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 s18-20020a17090aba1200b0020d4f9a4b4dsi1415132pjr.49.2022.10.25.23.30.10; Tue, 25 Oct 2022 23:30:21 -0700 (PDT) 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=rnTWDXJ0; 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 S233045AbiJZGFA (ORCPT + 99 others); Wed, 26 Oct 2022 02:05:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232896AbiJZGE7 (ORCPT ); Wed, 26 Oct 2022 02:04:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C67153D20 for ; Tue, 25 Oct 2022 23:04:58 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 07A0561CF8 for ; Wed, 26 Oct 2022 06:04:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF2B6C433B5; Wed, 26 Oct 2022 06:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666764297; bh=YzRMUuZtNje+a9bdS2vE+iVnqGt9NamYfN5MBaoJaXE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rnTWDXJ0eecn4uSfH2eN5KcFihxZfpvtO8pAd20KYGz4beuL0lrVuJAUxn1x+99/q 555qoNKDn6tT84rP4B1E3JSNt+ojyE/TCbJukhYbf6961o5H9FZYSdlu0ERex/G7Dy rsAC03uTew5TtUmVKgh+h3wJVUqPzjARXX1a29DEDJLhaSsxdnttbEMtd6KwX/myEQ 9I0LaA7CIJ7ZLM/bKFsnrXn0Kp6lUE/HOMyGCyPVH0dh5KDINGv4pI34eIMGnCpYRL ibnq6/WLrEJq/+4QHiV7fMXGWpi+v0AGPmlVBIZ6TAJpuoAlroKGrsfGyG+p1tRubK qMHTJtxyweNAA== Date: Wed, 26 Oct 2022 09:04:44 +0300 From: Mike Rapoport To: Yajun Deng Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] memblock: remove repeat round Message-ID: References: <20221019120337.2098298-1-yajun.deng@linux.dev> <6cccd4cba4f8407d52815c68f60446fb@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6cccd4cba4f8407d52815c68f60446fb@linux.dev> X-Spam-Status: No, score=-7.6 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 Tue, Oct 25, 2022 at 03:24:58AM +0000, Yajun Deng wrote: > October 25, 2022 12:15 AM, "Mike Rapoport" wrote: > > >> @@ -598,22 +597,6 @@ static int __init_memblock memblock_add_range(struct memblock_type *type, > >> return 0; > >> } > >> > >> - /* > >> - * The worst case is when new range overlaps all existing regions, > >> - * then we'll need type->cnt + 1 empty regions in @type. So if > >> - * type->cnt * 2 + 1 is less than type->max, we know > >> - * that there is enough empty regions in @type, and we can insert > >> - * regions directly. > >> - */ > >> - if (type->cnt * 2 + 1 < type->max) > >> - insert = true; > >> - > >> -repeat: > >> - /* > >> - * The following is executed twice. Once with %false @insert and > >> - * then with %true. The first counts the number of regions needed > >> - * to accommodate the new area. The second actually inserts them. > >> - */ > >> base = obase; > >> nr_new = 0; > > > > I believe nr_new variable is no longer needed, is it? > > > No, nr_new is needed before memblock_merge_regions() for return. Why? -- Sincerely yours, Mike.