From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 47B77306B21 for ; Thu, 20 Nov 2025 20:11:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763669480; cv=none; b=g3XtDDg7PnF7uBmcbUTmyBy5S25ONu9FH2SrhsJON/UgLZhAiO+NQ3xcngv95+nG6yu016PuSKE3QPqNKYR25ws/FHOHNoLi23KJBUbpKLERnqJg3SH05LCMCNEkbwDLoipJ7FiThmPw5kjThYoxqhQ4qK5Yxniwq/4S5nTGCJc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763669480; c=relaxed/simple; bh=Z3/epAMNqYRZzaVMljSrXso/3ErfzeocPyNH+heJweI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FXRQdxVlhnnjJSEAHeKzU10RXCMAU8CN0QvEcqeaJUEUvssvbHch+Lcz/ZiqUL3U+O2IbgsFTtkUB1viuQhjzRtm7ZXstIIi5Kskrn4kFfxZnTI8LA4qgTDzascN/0uRyMA/fRXubXoYN15atavivwIiitgszaE+Lp6Kux7ZYss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=o7y49xd1; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="o7y49xd1" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=4Mk5oAJEe+EJXniRo6EvF68sF+I7K1SlxfHz2eY7y68=; b=o7y49xd1bIJss61h943uGovO6C ndWFoS+qBoj2F4mMR/4Pax/u0+HLveLzEm5oqc87spBpJbgjwDW1RViTTYttbelqxTST3Sgq0LwY1 0jWs6lyb2EpBQiaPxlApurqaG/JgLTstPzf0HqHXGYzgB8z8fz+lugiiG/OHTJBpkMvXPHNiqu7uD ioRQNeqtWPrI7fp/39IvGYqOZwrLPRFw/gxpYGkY27LgQLE5lnUg/jiqJFeBn+tLJtB5YmAdj7mQ6 IStDtWHQ707sDjH//GCPmWtdektwZ0Yp5+ie+Y4CPQ8zwRIcqU44/vtpiFQXbFpGb3N7HSVIK7ke5 dnhe6i3A==; Received: from willy by casper.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1vMAzl-00000001jnZ-0eR7; Thu, 20 Nov 2025 20:11:09 +0000 Date: Thu, 20 Nov 2025 20:11:08 +0000 From: Matthew Wilcox To: Linus Torvalds Cc: Vlastimil Babka , Andrew Morton , Harry Yoo , David Rientjes , Christoph Lameter , Roman Gushchin , "linux-mm@kvack.org" , LKML , Christoph Hellwig Subject: Re: [GIT PULL] slab fix for 6.18-rc7 Message-ID: References: <3f4ec3be-0725-43cc-a75b-72549ebdc5c9@suse.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Nov 20, 2025 at 10:58:13AM -0800, Linus Torvalds wrote: > On Thu, 20 Nov 2025 at 10:45, Vlastimil Babka 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())