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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94FF0FA3740 for ; Mon, 31 Oct 2022 08:17:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbiJaIRH (ORCPT ); Mon, 31 Oct 2022 04:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbiJaIRF (ORCPT ); Mon, 31 Oct 2022 04:17:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FA7865FB for ; Mon, 31 Oct 2022 01:17:05 -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 CC27461031 for ; Mon, 31 Oct 2022 08:17:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66D6DC433B5; Mon, 31 Oct 2022 08:17:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667204224; bh=URxGX3rN0t4vDzNmnpRLGdtDfedX1xDpndmmWDxKjO8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gtizLyWTlicoIYLxEUip8appSngpFlGx70dK3zqlq3RovHYO7gKMpOQ4Mh5qXatxT LxEjp3/8Ndfqq6sCyMkIMc+2pk6Ds24u1eP0qb+/sHcWOTnq6kqFPeI1oUXN4ll+Fe vnMIUqPTjV6MzSAw5o0wMrNbEBEVPA0g+V2YbzqkF+KJa1AuOO8OPTt+Edd6K4Cgoo HB/ayGS9vDJnW5BIF9laUa8v6ZlPvSSO2hdCg6Cfk8VR89TPEfvu+bSwcEbIRbTWsd CokEf+FfcdErmqBzG3zdHwUSdBEnxzh1yY7nze9g4gzDI13JP4WdXp1D6MUCtakIEF Ex6+5XlAdWysQ== Date: Mon, 31 Oct 2022 10:16:51 +0200 From: Mike Rapoport To: Yajun Deng Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] memblock: don't run loop in memblock_add_range() twice Message-ID: References: <20221025070943.363578-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221025070943.363578-1-yajun.deng@linux.dev> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 25, 2022 at 03:09:43PM +0800, Yajun Deng wrote: > There is no need round twice in memblock_add_range(). > > We can call memblock_double_array() to extend the size if type->cnt > greater or equal to type->max before memblock_insert_region(); otherwise, > we can insert the new region directly. > > v2: > - Add a comment when the allocation is required. > > Signed-off-by: Yajun Deng > --- > mm/memblock.c | 69 ++++++++++++++++++--------------------------------- > 1 file changed, 24 insertions(+), 45 deletions(-) Applied, thanks!