* [GIT PULL] slab fix for 6.18-rc7
@ 2025-11-20 18:45 Vlastimil Babka
2025-11-20 18:58 ` Linus Torvalds
2025-11-20 19:00 ` pr-tracker-bot
0 siblings, 2 replies; 6+ messages in thread
From: Vlastimil Babka @ 2025-11-20 18:45 UTC (permalink / raw)
To: Linus Torvalds
Cc: Andrew Morton, Harry Yoo, David Rientjes, Christoph Lameter,
Roman Gushchin, linux-mm, LKML, Christoph Hellwig
Hi Linus,
please pull the latest slab fixes (actually mempool specific this time,
which is under SLAB in MAINTAINERS now as well).
Thanks,
Vlastimil
======================================
* Fix mempool poisoning order>0 pages with CONFIG_HIGHMEM (Vlastimil Babka)
======================================
The following changes since commit cbcff934fa7deb670d9545a3aad4d07e8f1e4f3c:
mm/slub: fix memory leak in free_to_pcs_bulk() (2025-11-13 19:56:46 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git tags/slab-for-6.18-rc7
for you to fetch changes up to ec33b59542d96830e3c89845ff833cf7b25ef172:
mm/mempool: fix poisoning order>0 pages with HIGHMEM (2025-11-14 17:55:23 +0100)
----------------------------------------------------------------
slab fix for 6.18-rc7
----------------------------------------------------------------
Vlastimil Babka (1):
mm/mempool: fix poisoning order>0 pages with HIGHMEM
mm/mempool.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [GIT PULL] slab fix for 6.18-rc7 2025-11-20 18:45 [GIT PULL] slab fix for 6.18-rc7 Vlastimil Babka @ 2025-11-20 18:58 ` Linus Torvalds 2025-11-20 20:11 ` Matthew Wilcox 2025-11-20 19:00 ` pr-tracker-bot 1 sibling, 1 reply; 6+ messages in thread From: Linus Torvalds @ 2025-11-20 18:58 UTC (permalink / raw) To: Vlastimil Babka Cc: Andrew Morton, Harry Yoo, David Rientjes, Christoph Lameter, Roman Gushchin, linux-mm, LKML, Christoph Hellwig On Thu, 20 Nov 2025 at 10:45, Vlastimil Babka <vbabka@suse.cz> wrote: > > * Fix mempool poisoning order>0 pages with CONFIG_HIGHMEM (Vlastimil Babka) I've pulled this, but honestly, CONFIG_HIGHMEM should be considered a dying breed, and I'd have been happier with just not adding extra code for that thing. Seriously, CONFIG_HIGHMEM is legacy x86 computers and embedded - old - arm stuff. Fixing debug code for this is simply not worth it. Nobody does actual kernel debugging on those platforms. It already skips poisoning for *much* more important cases, I really think the whole CONFIG_SLUB_DEBUG_ON could have been conditional on !CONFIG_HIGHMEM. In fact, not just SLUB_DEBUG_ON. I suspect *all* of SLUB_DEBUG could be disabled for non-highmem cases, but I guess that right now it's only CONFIG_SLUB_DEBUG_ON that triggers this situation anyway. We will literally get rid of CONFIG_HIGHMEM entirely at some point, but before we finally get to that point, I think we might as well at least limit the pain. Because HIGHMEM has always been just that: pain. Let's not add to it any more. Linus ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GIT PULL] slab fix for 6.18-rc7 2025-11-20 18:58 ` Linus Torvalds @ 2025-11-20 20:11 ` Matthew Wilcox 2025-11-20 21:37 ` Linus Torvalds 0 siblings, 1 reply; 6+ messages in thread From: Matthew Wilcox @ 2025-11-20 20:11 UTC (permalink / raw) To: Linus Torvalds Cc: Vlastimil Babka, Andrew Morton, Harry Yoo, David Rientjes, Christoph Lameter, Roman Gushchin, linux-mm, LKML, Christoph Hellwig On Thu, Nov 20, 2025 at 10:58:13AM -0800, Linus Torvalds wrote: > On Thu, 20 Nov 2025 at 10:45, Vlastimil Babka <vbabka@suse.cz> wrote: > > > > * Fix mempool poisoning order>0 pages with CONFIG_HIGHMEM (Vlastimil Babka) > > I've pulled this, but honestly, CONFIG_HIGHMEM should be considered a > dying breed, and I'd have been happier with just not adding extra code > for that thing. Would you rather see something like this that hides the fact it's dealing with HIGHMEM? diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 0091ad1986bf..68b952e68176 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -623,8 +623,10 @@ PAGEFLAG_FALSE(HighMem, highmem) /* Does kmap_local_folio() only allow access to one page of the folio? */ #ifdef CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP #define folio_test_partial_kmap(f) true +#define PagePartialKmap(p) true #else #define folio_test_partial_kmap(f) folio_test_highmem(f) +#define PagePartialKmap(p) PageHighMem(p) #endif #ifdef CONFIG_SWAP diff --git a/mm/mempool.c b/mm/mempool.c index 1c38e873e546..b1f5d81d70c6 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -67,11 +67,19 @@ static void check_element(mempool_t *pool, void *element) __check_element(pool, element, kmem_cache_size(pool->pool_data)); } else if (pool->free == mempool_free_pages) { /* Mempools backed by page allocator */ - int order = (int)(long)pool->pool_data; - void *addr = kmap_local_page((struct page *)element); - - __check_element(pool, addr, 1UL << (PAGE_SHIFT + order)); - kunmap_local(addr); + size_t len = 1UL << (long)pool->pool_data; + do { + struct page *page = (struct page *)element; + void *addr = kmap_local_page(page); + size_t chunk = len; + + if (PagePartialKmap(page) && chunk > PAGE_SIZE) + chunk = PAGE_SIZE; + __check_element(pool, addr, chunk); + kunmap_local(addr); + len -= chunk; + element += chunk; + } while (len > 0); } } (not actually tested, but based on memcpy_from_folio()) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GIT PULL] slab fix for 6.18-rc7 2025-11-20 20:11 ` Matthew Wilcox @ 2025-11-20 21:37 ` Linus Torvalds 2025-11-20 21:55 ` Linus Torvalds 0 siblings, 1 reply; 6+ messages in thread From: Linus Torvalds @ 2025-11-20 21:37 UTC (permalink / raw) To: Matthew Wilcox Cc: Vlastimil Babka, Andrew Morton, Harry Yoo, David Rientjes, Christoph Lameter, Roman Gushchin, linux-mm, LKML, Christoph Hellwig On Thu, 20 Nov 2025 at 12:11, Matthew Wilcox <willy@infradead.org> wrote: > > Would you rather see something like this that hides the fact it's > dealing with HIGHMEM? NO! I would rather see us stop writing WORSE CODE due to the abomination that is HIGHMEM. > @@ -67,11 +67,19 @@ static void check_element(mempool_t *pool, void *element) You just added more lines of code to deal with something that we shouldn't spend one second of time on, and that we should *not* write more complex code for. IOW, I think what should happen is just something like below. IOW, just remove the useless garbage. Think of it as a small step towards the eventual bright future that is lack of HIGHMEM. HIGHMEM was a mistake forced on us by bad hardware. We should revel in the fact that it is not really relevant any more. Linus --- diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index 32b65073d0cc..ecfb65c09651 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -58,7 +58,7 @@ config SLUB_DEBUG config SLUB_DEBUG_ON bool "SLUB debugging on by default" - depends on SLUB_DEBUG + depends on SLUB_DEBUG && !HIGHMEM select STACKDEPOT_ALWAYS_INIT if STACKTRACE_SUPPORT default n help diff --git a/mm/mempool.c b/mm/mempool.c index d7bbf1189db9..22157d23cdd9 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -12,7 +12,6 @@ #include <linux/mm.h> #include <linux/slab.h> -#include <linux/highmem.h> #include <linux/kasan.h> #include <linux/kmemleak.h> #include <linux/export.h> @@ -68,20 +67,9 @@ static void check_element(mempool_t *pool, void *element) } else if (pool->free == mempool_free_pages) { /* Mempools backed by page allocator */ int order = (int)(long)pool->pool_data; - -#ifdef CONFIG_HIGHMEM - for (int i = 0; i < (1 << order); i++) { - struct page *page = (struct page *)element; - void *addr = kmap_local_page(page + i); - - __check_element(pool, addr, PAGE_SIZE); - kunmap_local(addr); - } -#else void *addr = page_address((struct page *)element); __check_element(pool, addr, PAGE_SIZE << order); -#endif } } @@ -107,20 +95,9 @@ static void poison_element(mempool_t *pool, void *element) } else if (pool->alloc == mempool_alloc_pages) { /* Mempools backed by page allocator */ int order = (int)(long)pool->pool_data; - -#ifdef CONFIG_HIGHMEM - for (int i = 0; i < (1 << order); i++) { - struct page *page = (struct page *)element; - void *addr = kmap_local_page(page + i); - - __poison_element(addr, PAGE_SIZE); - kunmap_local(addr); - } -#else void *addr = page_address((struct page *)element); __poison_element(addr, PAGE_SIZE << order); -#endif } } #else /* CONFIG_SLUB_DEBUG_ON */ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GIT PULL] slab fix for 6.18-rc7 2025-11-20 21:37 ` Linus Torvalds @ 2025-11-20 21:55 ` Linus Torvalds 0 siblings, 0 replies; 6+ messages in thread From: Linus Torvalds @ 2025-11-20 21:55 UTC (permalink / raw) To: Matthew Wilcox Cc: Vlastimil Babka, Andrew Morton, Harry Yoo, David Rientjes, Christoph Lameter, Roman Gushchin, linux-mm, LKML, Christoph Hellwig On Thu, 20 Nov 2025 at 13:37, Linus Torvalds <torvalds@linux-foundation.org> wrote: > > HIGHMEM was a mistake forced on us by bad hardware. We should revel in > the fact that it is not really relevant any more. Btw. there are probably many other cases where we might just say "this makes no sense in HIGHMEM". But most of the time, it's not worth actively removing support for it - it's just more work. But when there's a case like this mempool debug thing, just say "we don't care about this debug feature for HIGHMEM" rather than trying to actually deal with it. IOW, just don't write extra code for it. Linus ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GIT PULL] slab fix for 6.18-rc7 2025-11-20 18:45 [GIT PULL] slab fix for 6.18-rc7 Vlastimil Babka 2025-11-20 18:58 ` Linus Torvalds @ 2025-11-20 19:00 ` pr-tracker-bot 1 sibling, 0 replies; 6+ messages in thread From: pr-tracker-bot @ 2025-11-20 19:00 UTC (permalink / raw) To: Vlastimil Babka Cc: Linus Torvalds, Andrew Morton, Harry Yoo, David Rientjes, Christoph Lameter, Roman Gushchin, linux-mm, LKML, Christoph Hellwig The pull request you sent on Thu, 20 Nov 2025 19:45:02 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git tags/slab-for-6.18-rc7 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/c966813ea1206abc50a4447cb05cd7419e506806 Thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-11-20 21:56 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-11-20 18:45 [GIT PULL] slab fix for 6.18-rc7 Vlastimil Babka 2025-11-20 18:58 ` Linus Torvalds 2025-11-20 20:11 ` Matthew Wilcox 2025-11-20 21:37 ` Linus Torvalds 2025-11-20 21:55 ` Linus Torvalds 2025-11-20 19:00 ` pr-tracker-bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox