All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,vasant.hegde@amd.com,osalvador@suse.de,muchun.song@linux.dev,david@kernel.org,dave@stgolabs.net,bharata@amd.com,dheerajkumar.srivastava@amd.com,akpm@linux-foundation.org
Subject: + mm-hugetlb-use-kvmalloc_objs-for-hugetlb_fault_mutex_table.patch added to mm-unstable branch
Date: Wed, 07 Oct 2026 11:48:34 -0700	[thread overview]
Message-ID: <20261007184835.3A8CC1F000FF@smtp.kernel.org> (raw)


The patch titled
     Subject: mm/hugetlb: use kvmalloc_objs for hugetlb_fault_mutex_table
has been added to the -mm mm-unstable branch.  Its filename is
     mm-hugetlb-use-kvmalloc_objs-for-hugetlb_fault_mutex_table.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb-use-kvmalloc_objs-for-hugetlb_fault_mutex_table.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Subject: mm/hugetlb: use kvmalloc_objs for hugetlb_fault_mutex_table
Date: Tue, 6 Oct 2026 21:31:28 +0530

On systems/VMs with a large number of CPUs (e.g.  4096), hugetlb_init()
computes num_fault_mutexes = roundup_pow_of_two(8 * num_possible_cpus()) =
32768.  The subsequent kmalloc for the mutex table can exceed
MAX_PAGE_ORDER when struct mutex is enlarged by debug options like
CONFIG_DEBUG_MUTEXES and CONFIG_DEBUG_LOCK_ALLOC, resulting in:

  WARNING: at __alloc_frozen_pages_noprof (order > MAX_PAGE_ORDER)
  kernel BUG at mm/hugetlb.c (BUG_ON(!hugetlb_fault_mutex_table))
  Kernel panic - not syncing: Fatal exception

Switch to kvmalloc_objs() so the allocation falls back to vmalloc when the
contiguous physical allocation is too large.  The table is only accessed
by index, so virtual contiguity is sufficient.

Link: https://lore.kernel.org/20261006160128.31447-1-dheerajkumar.srivastava@amd.com
Fixes: 8382d914ebf7 ("mm, hugetlb: improve page-fault scalability")
Signed-off-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: David Hildenbrand <david@kernel.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Vasant Hegde <vasant.hegde@amd.com>
Cc: Bharata B Rao <bharata@amd.com>
---

 mm/hugetlb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/hugetlb.c~mm-hugetlb-use-kvmalloc_objs-for-hugetlb_fault_mutex_table
+++ a/mm/hugetlb.c
@@ -4242,7 +4242,7 @@ static int __init hugetlb_init(void)
 	num_fault_mutexes = 1;
 #endif
 	hugetlb_fault_mutex_table =
-		kmalloc_objs(struct mutex, num_fault_mutexes);
+		kvmalloc_objs(struct mutex, num_fault_mutexes);
 	BUG_ON(!hugetlb_fault_mutex_table);
 
 	for (i = 0; i < num_fault_mutexes; i++)
_

Patches currently in -mm which might be from dheerajkumar.srivastava@amd.com are

mm-hugetlb-use-kvmalloc_objs-for-hugetlb_fault_mutex_table.patch


                 reply	other threads:[~2026-10-07 18:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261007184835.3A8CC1F000FF@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=bharata@amd.com \
    --cc=dave@stgolabs.net \
    --cc=david@kernel.org \
    --cc=dheerajkumar.srivastava@amd.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=vasant.hegde@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.