mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Detect kernels that honor gfp flags passed to vmalloc()
zfsonlinux/spl@2092cf68d8 used PF_MEMALLOC to workaround a bug in the Linux kernel where allocations did not honor the gfp flags passed to vmalloc(). Unfortunately, PF_MEMALLOC has the side effect of permitting allocations to allocate pages outside of ZONE_NORMAL. This has been observed to result in the depletion of ZONE_DMA32. A kernel patch is available in the Gentoo bug tracker for this issue. https://bugs.gentoo.org/show_bug.cgi?id=416685 This negates any benefit PF_MEMALLOC provides, so we introduce an autotools check to disable the use of PF_MEMALLOC on systems with patched kernels. Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #126
This commit is contained in:
committed by
Brian Behlendorf
parent
973e8269bd
commit
36811b4430
@@ -843,6 +843,9 @@ kv_alloc(spl_kmem_cache_t *skc, int size, int flags)
|
||||
if (skc->skc_flags & KMC_KMEM) {
|
||||
ptr = (void *)__get_free_pages(flags, get_order(size));
|
||||
} else {
|
||||
#ifdef HAVE_PMD_ALLOC_WITH_MASK
|
||||
ptr = __vmalloc(size, flags|__GFP_HIGHMEM, PAGE_KERNEL);
|
||||
#else
|
||||
/*
|
||||
* As part of vmalloc() an __pte_alloc_kernel() allocation
|
||||
* may occur. This internal allocation does not honor the
|
||||
@@ -866,6 +869,7 @@ kv_alloc(spl_kmem_cache_t *skc, int size, int flags)
|
||||
} else {
|
||||
ptr = __vmalloc(size, flags|__GFP_HIGHMEM, PAGE_KERNEL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Resulting allocated memory will be page aligned */
|
||||
|
||||
Reference in New Issue
Block a user