From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAEE0C38A2D for ; Wed, 26 Oct 2022 06:05:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2FE528E0002; Wed, 26 Oct 2022 02:05:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2AEAB8E0001; Wed, 26 Oct 2022 02:05:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19CD98E0002; Wed, 26 Oct 2022 02:05:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0ACB08E0001 for ; Wed, 26 Oct 2022 02:05:01 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C5F0414099B for ; Wed, 26 Oct 2022 06:05:00 +0000 (UTC) X-FDA: 80062062360.08.C8E1FFD Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf25.hostedemail.com (Postfix) with ESMTP id 2913AA0027 for ; Wed, 26 Oct 2022 06:04:59 +0000 (UTC) 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 ams.source.kernel.org (Postfix) with ESMTPS id A2940B81F42; 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> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666764300; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tYd0acwIcEv3q+BuJncJ4ARkXaIzBRKynOMy7ZsK2S8=; b=DDX7GhK+jYtZiBRONjO+QXNUM6yZGxbZJikDB8wqjscWpBmM4ng/EWVGa9EOyKXJmkkMHy sG/arzFLRY6WG5MMDT/Ys4F79Xx5NJcqGy8CwuvEG0eqQNxFfuiqM7FCPhphv5sCPHmYFc IMFZOeKXq82eTyv3Dh4d2Y/y/m22HRc= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rnTWDXJ0; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666764300; a=rsa-sha256; cv=none; b=iUYVKDpoiilMFYtiSw/sXBLb0LArxuzCfASjS3tvSPYf4ZIrLXuIzp1esiTEo5ib+4ESUN KdurGH9wLW185p1HZU4Z+aCO6V7sgcbYSd5mnZXyD3w9fwpjI72sVDS9BbnRlLgej3tfbX ZjhoV7FeiRdfyHT8+S5Z92MRDrQTR4s= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 2913AA0027 X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rnTWDXJ0; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf25.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org X-Stat-Signature: m9drk55w8uzjtxcuqn873jwiwdb8kpoi X-HE-Tag: 1666764299-766350 X-Bogosity: Ham, tests=bogofilter, spamicity=0.007035, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.