linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muchun Song <muchun.song@linux.dev>
To: Gang Li <gang.li@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Daniel Jordan <daniel.m.jordan@oracle.com>,
	Jane Chu <jane.chu@oracle.com>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	kernel test robot <lkp@intel.com>,
	Gang Li <ligang.bdlg@bytedance.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v1 2/2] hugetlb: process multiple lists in gather_bootmem_prealloc_parallel
Date: Tue, 13 Feb 2024 22:54:40 +0800	[thread overview]
Message-ID: <1B2A09F0-8F2B-426A-9D1D-6A39C3A6CF64@linux.dev> (raw)
In-Reply-To: <20240213111347.3189206-3-gang.li@linux.dev>



> On Feb 13, 2024, at 19:13, Gang Li <gang.li@linux.dev> 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 <ligang.bdlg@bytedance.com>

Reviewed-by: Muchun Song <muchun.song@linux.dev>

Thanks.



  reply	other threads:[~2024-02-13 14:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 11:13 [PATCH v1 0/2] hugetlb: two small improvements of hugetlb init parallelization Gang Li
2024-02-13 11:13 ` [PATCH v1 1/2] padata: downgrade padata_do_multithreaded to serial execution for non-SMP Gang Li
2024-02-13 14:52   ` Muchun Song
2024-02-13 15:15     ` Gang Li
2024-02-15 10:49       ` Muchun Song
2024-02-13 11:13 ` [PATCH v1 2/2] hugetlb: process multiple lists in gather_bootmem_prealloc_parallel Gang Li
2024-02-13 14:54   ` Muchun Song [this message]
2024-02-13 14:16 ` [PATCH v1 0/2] hugetlb: two small improvements of hugetlb init parallelization Paul E. McKenney
2024-02-19  3:03 ` Gang Li
2024-02-20  1:52   ` Andrew Morton
2024-02-20  6:17     ` Gang Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1B2A09F0-8F2B-426A-9D1D-6A39C3A6CF64@linux.dev \
    --to=muchun.song@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.m.jordan@oracle.com \
    --cc=gang.li@linux.dev \
    --cc=jane.chu@oracle.com \
    --cc=ligang.bdlg@bytedance.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=paulmck@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox