Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3099381rdb; Tue, 13 Feb 2024 06:59:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXYpv6GN+WFBaoYDd+lERTAdSj0Vb2RAEeo+BzBEbkl7UVQBXVAepDFSgmyr3mzYAEZL8FVTEhhiUA/UZCZvhzix7LvvZr+Q9HUoiTGdQ== X-Google-Smtp-Source: AGHT+IF19DJ/VlefKp7KcmCho9QPwQkAre6QxCnDuOYoN49V63cy1WQt5smfRJ7WuajqzKweuOCS X-Received: by 2002:a17:903:1c1:b0:1d9:5923:c242 with SMTP id e1-20020a17090301c100b001d95923c242mr10943781plh.42.1707836371337; Tue, 13 Feb 2024 06:59:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707836371; cv=pass; d=google.com; s=arc-20160816; b=pN3sO3uTe3a1InLVtff4GCrtA8P7ZRWXm65o0POBbKVSXqOGqtfhFdMU1aR6GG5ccR FC/X42SB6fuUm5HdCkVgRNGCTddn50TKkaSWavdxcXgIf34tkaIrKTS3YR+o3D/0439D ch8VVY6WsvSqB2jtvJsS/pHwyfZi1GSQu3Rp+LZ7kK7TWiHBym4OyjNGfHtiQv0k9fjT b2vq8VjzyxvmPB7Bm50/EQVst3KQrVqHKjBYsgwGu+KV5ihsf2PhWg0eaD8isbHYhclD 7Jyi3D4qCbfpILG6Ex07bhP7x+5nUyTe6ozgva+KuYHPnjqdVKwTdRi6gWUcBWfiSdsc vzWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=odYQg0X9p03RWw1VAUk5+w53bWUrUJQlPaSag6Pv+fw=; fh=+qowMY0JJqr5qmog4HelQCB9FsjbrKQdMtr9NpPme2Y=; b=Op4QCHXL6HjYpIUroLt/W4ChqI+Tt1+bzXERW736LaO/YIv8Tsmw/Sm0OShjbyAq6L vmmmsG5t8FRkIoGxoEXM+RJzD7e5kpbxGXaizzXQKOgXn8uUfcHLbidKyQF6UGYkrA4F J1bR+QTbi9V52zWpO2prvEv1J+DOuOk5EvVVmlTaduoH4MO9tyKy9FLerduR4uImPZZW btyInW8M3z5In4cffZqNf/r+iqOlM7/TeDeNE7y374fkzHw/gb9kPBM0gd4DeF1Gkedj 9dWw0yMoxo6Yvnf8sU6UyzvSnJbjI+I18qUagWBCOVZSfpfLJveS6PMbjkBz9JDoyxD+ X0uA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=KYTVHJp3; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-63730-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev X-Forwarded-Encrypted: i=2; AJvYcCWUyF/PgZ6H7CeM5M9p+p5HkjHWFKn3rPVMDNOhon9SsMl21jBv1V1s5asZ8pR5nLFkhppInKErQ3Sez7AIt0ziZYMZBhzu3O2/UAoJWQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id kd14-20020a17090313ce00b001d9c37d7188si2109325plb.201.2024.02.13.06.59.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 06:59:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63730-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=KYTVHJp3; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-63730-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63730-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id CB8D028CB00 for ; Tue, 13 Feb 2024 14:56:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C184A5FB85; Tue, 13 Feb 2024 14:55:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="KYTVHJp3" Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (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 CAFBA5FB81 for ; Tue, 13 Feb 2024 14:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707836120; cv=none; b=fVl+LLd4Ix9ote2beqTKobNb3VyboCGT16s6YyP8tckhc6AJf295ehdFb0zOIIF1XzvIItfNG+oZ5I9NdWWAUJpcpVIdJmKGeGAf6ouXFNvYKfiYzRxLagQerwuBCxysHJCplGzG8V0LXPXFxpNO4uyYiEdsdeVuSxeJHE5ryW0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707836120; c=relaxed/simple; bh=pbQ9YJSw5E0+ttHRSXOOHeePYtcyL9fOOfJ+pMzPZjw=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=q9sfuDGrmzM+QjQLsP2apgLMlPpTLPtcRCvcuo5ifXX1uGEG/yQC5eEatNFvRZySBZOxNw7miISO5MjfCKgy9UU236KYD4FonuoqQCo6++yx2bLrm6nmSSCLuDkaIP9vIJ8UMwMjj3UyJE5LvZHzbVjsxE8KCRHj/2+cejOq3rc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=KYTVHJp3; arc=none smtp.client-ip=95.215.58.171 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 Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1707836115; 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=odYQg0X9p03RWw1VAUk5+w53bWUrUJQlPaSag6Pv+fw=; b=KYTVHJp3bZ4HyXSa9gVUA7hxufisU/fPUeL6G7jUuLNTFkA3o2EphAGK6sIdAS3pHd1Lcl D8+S9dbL//Ecx9d2IEUQN2TwTFketNEQ1ZSC46SW7H0oCvZdkaeICRdoYwZtJLsUPfay7y E3sVn7QZdsvgvCcd3ijFrW1zjH8362s= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Subject: Re: [PATCH v1 2/2] hugetlb: process multiple lists in gather_bootmem_prealloc_parallel X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20240213111347.3189206-3-gang.li@linux.dev> Date: Tue, 13 Feb 2024 22:54:40 +0800 Cc: Andrew Morton , Steffen Klassert , Daniel Jordan , Jane Chu , "Paul E . McKenney" , Randy Dunlap , kernel test robot , Gang Li , linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Transfer-Encoding: 7bit Message-Id: <1B2A09F0-8F2B-426A-9D1D-6A39C3A6CF64@linux.dev> References: <20240213111347.3189206-1-gang.li@linux.dev> <20240213111347.3189206-3-gang.li@linux.dev> To: Gang Li X-Migadu-Flow: FLOW_OUT > On Feb 13, 2024, at 19:13, Gang Li wrote: > > gather_bootmem_prealloc_node currently only process one list in > huge_boot_pages array. So gather_bootmem_prealloc expects > padata_do_multithreaded to run num_node_state(N_MEMORY) instances of > gather_bootmem_prealloc_node to process all lists in huge_boot_pages. > > This works well in current padata_do_multithreaded implementation. > It guarantees that size/min_chunk <= thread num <= max_threads. > > ``` > /* Ensure at least one thread when size < min_chunk. */ > nworks = max(job->size / max(job->min_chunk, job->align), 1ul); > nworks = min(nworks, job->max_threads); > > ps.nworks = padata_work_alloc_mt(nworks, &ps, &works); > ``` > > However, the comment of padata_do_multithreaded API only promises a > maximum value for the number of threads and does not specify a > minimum value. Which may pass multiple nodes to > gather_bootmem_prealloc_node and only one node will be processed. > > To avoid potential errors, introduce gather_bootmem_prealloc_parallel > to handle the case where the number of threads does not meet the > requirement of max_threads. > > Fixes: 0306f03dcbd7 ("hugetlb: parallelize 1G hugetlb initialization") > Signed-off-by: Gang Li Reviewed-by: Muchun Song Thanks.