Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp255897rwi; Tue, 25 Oct 2022 23:59:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5yC+DiU1m+ZoLKNsHfs+7yGQGsTnsm4PCYvZs3/KQBRU/LnVQ6Nys5z7cwbvoS+2pm/s+Y X-Received: by 2002:a17:902:b589:b0:179:f8c5:7212 with SMTP id a9-20020a170902b58900b00179f8c57212mr42316023pls.174.1666767589987; Tue, 25 Oct 2022 23:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666767589; cv=none; d=google.com; s=arc-20160816; b=lBjWWMgq4qpRNtKwvUfY9qioDaU2PG7xeNM6u3wxUCuywNtUjtPTQ1sSj3UuAwC0Bg CDQV+HJAanX2VqhU7bHXq7M/JCbyW8St93dTn6y8sNusaxdus2i4xgJVTH0igRfnS/RD FqpQpqp1dq1eKFq/Yv3uOlRskDgjzBrS3yTmY6h2R2IBRMNVLnQcSjwGQkVtim5WXty8 EigB5hcKzxIT1SXt1LpZkJaWUmXgaFh94+u0UPlC5qwcz0i6JcvYSKMZld26JHfsBUgQ //q3e89EDv1s5+zbsa0zaEdpBfFYhWrrU9CV31ec6tEeKTEEZIkTCRKUukO38lc1kwgJ pb/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:cc:to:subject:message-id :from:content-transfer-encoding:date:dkim-signature:mime-version; bh=F1h2nRHncW11E9hbd/qHDUawOsfI9aSjq5L1zDtP0vo=; b=PUBbtNhRP9xG+z+IWYLbQ/SU1nKmNUG5hq1OItyXHzPzhQU2Z9TnSL19q13JRFN7YF 1ffvBjcjAw+wBWTD2LCoKTb3zs1Cl79Jg1rz1h93jqaH+3ykCEh7AGoLQRVCKRhuLP+j oaEzg8XrQ3NxE7Rw6fL/4/zxUdKKDgDJ01ALZ5k/eHIjwASNStLRhlpcots8nJ2Ilwd5 seQtCSrHkrGPho6ois2o0AWBneJBmxmn/cbAQcE7tLGuZuDm/OC3s+D+p014Gz1yFGBj +0at/dPu8csVxmEh31jLcaUEo5QGLRdDJrDvsvM9cJT9wlrDup55ZDlxIPCIh3ZH7vow aZ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=XaHlgRjh; 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=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id np17-20020a17090b4c5100b00202827b6f5asi1843828pjb.162.2022.10.25.23.59.21; Tue, 25 Oct 2022 23:59:49 -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=@linux.dev header.s=key1 header.b=XaHlgRjh; 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=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233116AbiJZGSI (ORCPT + 99 others); Wed, 26 Oct 2022 02:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232948AbiJZGSH (ORCPT ); Wed, 26 Oct 2022 02:18:07 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA00BA278 for ; Tue, 25 Oct 2022 23:18:06 -0700 (PDT) MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1666765084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F1h2nRHncW11E9hbd/qHDUawOsfI9aSjq5L1zDtP0vo=; b=XaHlgRjh0xMKIeZT1Iyrc7R4v2F3klDrIor2q8nv0TUmZP0JVdW58yMsP8/WTwMGH46IQE gLpjVLn7E93oTmKQVn3F3fS5Q/Fa7hSqTsiv3YQC+XMTbOkKNnWtQcrrV+unkExj/eb4cy RRZiPUYw5B/DYUNqXaNzTlniJt90LXg= Date: Wed, 26 Oct 2022 06:18:03 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Yajun Deng" Message-ID: Subject: Re: [PATCH] memblock: remove repeat round To: "Mike Rapoport" Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org In-Reply-To: References: <20221019120337.2098298-1-yajun.deng@linux.dev> <6cccd4cba4f8407d52815c68f60446fb@linux.dev> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED 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 October 26, 2022 2:04 PM, "Mike Rapoport" wrote:=0A=0A>= On Tue, Oct 25, 2022 at 03:24:58AM +0000, Yajun Deng wrote:=0A> =0A>> Oc= tober 25, 2022 12:15 AM, "Mike Rapoport" wrote:=0A>> = =0A>> @@ -598,22 +597,6 @@ static int __init_memblock memblock_add_range(= struct memblock_type *type,=0A>> return 0;=0A>> }=0A>> =0A>> - /*=0A>> - = * The worst case is when new range overlaps all existing regions,=0A>> - = * then we'll need type->cnt + 1 empty regions in @type. So if=0A>> - * ty= pe->cnt * 2 + 1 is less than type->max, we know=0A>> - * that there is en= ough empty regions in @type, and we can insert=0A>> - * regions directly.= =0A>> - */=0A>> - if (type->cnt * 2 + 1 < type->max)=0A>> - insert =3D tr= ue;=0A>> -=0A>> -repeat:=0A>> - /*=0A>> - * The following is executed twi= ce. Once with %false @insert and=0A>> - * then with %true. The first coun= ts the number of regions needed=0A>> - * to accommodate the new area. The= second actually inserts them.=0A>> - */=0A>> base =3D obase;=0A>> nr_new= =3D 0;=0A>> =0A>> I believe nr_new variable is no longer needed, is it?= =0A>> =0A>> No, nr_new is needed before memblock_merge_regions() for retu= rn.=0A> =0A> Why?=0A> =0ASorry, nr_new was removed, and added ocnt variab= le for the original of type->cnt.=0A=0AI already sent another patch with = '[PATCH v2] memblock: don't run loop in =0Amemblock_add_range() twice' su= bject, you can see that.=0A=0A> --=0A> Sincerely yours,=0A> Mike.