mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
Merge tag 'slab-for-6.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab
Pull slab fix from Vlastimil Babka: - Fix mempool poisoning order>0 pages with CONFIG_HIGHMEM (Vlastimil Babka) * tag 'slab-for-6.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab: mm/mempool: fix poisoning order>0 pages with HIGHMEM
This commit is contained in:
32
mm/mempool.c
32
mm/mempool.c
@@ -68,10 +68,20 @@ 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;
|
||||
void *addr = kmap_local_page((struct page *)element);
|
||||
|
||||
__check_element(pool, addr, 1UL << (PAGE_SHIFT + order));
|
||||
kunmap_local(addr);
|
||||
#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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,10 +107,20 @@ 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;
|
||||
void *addr = kmap_local_page((struct page *)element);
|
||||
|
||||
__poison_element(addr, 1UL << (PAGE_SHIFT + order));
|
||||
kunmap_local(addr);
|
||||
#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 */
|
||||
|
||||
Reference in New Issue
Block a user