Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1395726rdd; Wed, 10 Jan 2024 19:31:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IFq1zbEFFPxsM1uVrS4sri6CeluhGeW2GDifw/lgScF3L+PvvgRvCfCVfLNiN3p+p99WoW5 X-Received: by 2002:a05:6214:3290:b0:680:f643:b717 with SMTP id mu16-20020a056214329000b00680f643b717mr523624qvb.96.1704943897694; Wed, 10 Jan 2024 19:31:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704943897; cv=none; d=google.com; s=arc-20160816; b=bqXKUcayG9SQh8UaPTFnUNDCCQaCAMaoavfITlJloMfXWNQVrrNEKSHap8TbVPgpdx 8gvOXfBWaMCDO9HL1Z2yDvVMHOEA7ancKIUL4AV2JYZRYt2X2LxUOzNU4qhnbseCrAyP +xYSMP3ROovET8cSrC2bGQH7Z0vwCfndYqQGkDdg9SminqjaKGMl8JK4cLX54ENS00AN /ZV3nrY33l2YR+ZOSp69yk+TBjqi6PnWZluh3gkenl31KQTisNT7jn2ecAZvzkqeDzmh aNjr4KY/KMIfD++LWkrYkplq1v0SQmut4BGBcEu5cZr4CdqbR2rX4H+KpoiavOJMHUqA j1TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=K0dgdoE6OzasbBRrKE1GhrUB+ZWb0Jou+J+d3JWPw3A=; fh=xCjkyQGojzM5WxNDWC+TLfAtXpP60AUYfGw1ZfFryg8=; b=YgOi8EQJDHxUdJnEtyxR+bvaOHODdeGEPXNnbQs/ZeKcsInY/AwYpkZfyaPI6P0uYb buLCo5k9Z/VJZEoTmHJwTkyqboDjlqaY7X9YeP4HxXxiFoWrztLsbd7o5/JXJRz/Ic3B kEoraqu0DOfMNU5JWXPNlW7dmsCnF0nov6uN8awD0mVEnvHJbqDWmnQiugWwiBEvAkTZ ZpoBdvaLs9uxV2iW3HGyS/toE81D+Eu14BAhjCU30RU1iJE+aJLh2b3a/fUyvU0Qped+ l7jmdxukQSKDHMS+2mbdk4Y1EntijU7yR9ckDhQ58814rSDMf/jpx+q62EuQ+9UuGDTp d6Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=sFkAxDeI; spf=pass (google.com: domain of linux-kernel+bounces-23031-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23031-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g3-20020a0caac3000000b006809d5461a6si37767qvb.510.2024.01.10.19.31.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 19:31:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23031-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=sFkAxDeI; spf=pass (google.com: domain of linux-kernel+bounces-23031-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23031-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 727431C2163A for ; Thu, 11 Jan 2024 03:31:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7DE76111D; Thu, 11 Jan 2024 03:31:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="sFkAxDeI" Received: from out-187.mta0.migadu.com (out-187.mta0.migadu.com [91.218.175.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4BC5EC0 for ; Thu, 11 Jan 2024 03:31:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1704943880; 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=K0dgdoE6OzasbBRrKE1GhrUB+ZWb0Jou+J+d3JWPw3A=; b=sFkAxDeItSQnYqjjK7nh77pjlOZPi4bghgbIuwWh+6moNF/AdeGybgkMoLeIUVU57ogIrO xH7JiAyPRSSWZ6GbuIcVnfrsDIHfCmdmRi2Hf//9g6BB5HB71u93xl7MpWbZV3yz4NEsLh n0G5Q0kDJc3ytVFSQsFOdWyTKRFYnhY= Date: Thu, 11 Jan 2024 11:30:52 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v3 1/7] hugetlb: code clean for hugetlb_hstate_alloc_pages Content-Language: en-US To: Muchun Song Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, ligang.bdlg@bytedance.com, David Hildenbrand , David Rientjes , Mike Kravetz , Andrew Morton , Tim Chen References: <20240102131249.76622-1-gang.li@linux.dev> <20240102131249.76622-2-gang.li@linux.dev> <73111be3-3077-4821-8c2f-9c5564cb2bb7@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Gang Li In-Reply-To: <73111be3-3077-4821-8c2f-9c5564cb2bb7@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 2024/1/10 18:19, Muchun Song wrote: > > > On 2024/1/2 21:12, Gang Li wrote: >> The readability of `hugetlb_hstate_alloc_pages` is poor. By cleaning the >> code, its readability can be improved, facilitating future modifications. >> >> This patch extracts two functions to reduce the complexity of >> `hugetlb_hstate_alloc_pages` and has no functional changes. >> >> - hugetlb_hstate_alloc_pages_node_specific() to handle iterates through >>    each online node and performs allocation if necessary. >> - hugetlb_hstate_alloc_pages_report() report error during allocation. >>    And the value of h->max_huge_pages is updated accordingly. >> >> Signed-off-by: Gang Li >> --- >>   mm/hugetlb.c | 46 +++++++++++++++++++++++++++++----------------- >>   1 file changed, 29 insertions(+), 17 deletions(-) >> >> diff --git a/mm/hugetlb.c b/mm/hugetlb.c >> index ed1581b670d42..2606135ec55e6 100644 >> --- a/mm/hugetlb.c >> +++ b/mm/hugetlb.c >> @@ -3482,6 +3482,33 @@ static void __init >> hugetlb_hstate_alloc_pages_onenode(struct hstate *h, int nid) >>       h->max_huge_pages_node[nid] = i; >>   } >> +static bool __init hugetlb_hstate_alloc_pages_node_specific(struct >> hstate *h) > > I'd like to rename this to hugetlb_hstate_alloc_pages_specific_nodes. > > Otherwise, LGTM. > > Reviewed-by: Muchun Song > Thanks! I will adjust it in the next version.