aboutsummaryrefslogtreecommitdiffstats
path: root/module/os
diff options
context:
space:
mode:
authorMichael Niewöhner <[email protected]>2019-08-06 13:28:56 +0200
committerBrian Behlendorf <[email protected]>2019-11-13 10:05:23 -0800
commit8aaa10a9a059589ca8a57c3e91c12ad520fb6f30 (patch)
tree42772ea8f0925e80dae406523147c2e095f699f4 /module/os
parent6d948c3519ab7a52c06f68927737a3199ba13f81 (diff)
Check for __GFP_RECLAIM instead of GFP_KERNEL
Check for __GFP_RECLAIM instead of GFP_KERNEL because zfs modifies IO and FS flags which breaks the check for GFP_KERNEL. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Matt Ahrens <[email protected]> Reviewed-by: Sebastian Gottschall <[email protected]> Signed-off-by: Michael Niewöhner <[email protected]> Closes #9034
Diffstat (limited to 'module/os')
-rw-r--r--module/os/linux/spl/spl-kmem.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/module/os/linux/spl/spl-kmem.c b/module/os/linux/spl/spl-kmem.c
index d2799b5bd..defbe80a2 100644
--- a/module/os/linux/spl/spl-kmem.c
+++ b/module/os/linux/spl/spl-kmem.c
@@ -137,6 +137,10 @@ EXPORT_SYMBOL(kmem_strfree);
#ifndef __GFP_RETRY_MAYFAIL
#define __GFP_RETRY_MAYFAIL __GFP_REPEAT
#endif
+/* Kernel compatibility for <4.4 */
+#ifndef __GFP_RECLAIM
+#define __GFP_RECLAIM __GFP_WAIT
+#endif
void *
spl_kvmalloc(size_t size, gfp_t lflags)
@@ -186,14 +190,15 @@ spl_kvmalloc(size_t size, gfp_t lflags)
* We first try kmalloc - even for big sizes - and fall back to
* __vmalloc if that fails.
*
- * For non-GFP_KERNEL allocations we always stick to kmalloc_node,
- * and fail when kmalloc is not successful (returns NULL).
+ * For non-__GFP-RECLAIM allocations we always stick to
+ * kmalloc_node, and fail when kmalloc is not successful (returns
+ * NULL).
* We cannot fall back to __vmalloc in this case because __vmalloc
* internally uses GPF_KERNEL allocations.
*/
void *ptr = kmalloc_node(size, kmalloc_lflags, NUMA_NO_NODE);
if (ptr || size <= PAGE_SIZE ||
- (lflags & GFP_KERNEL) != GFP_KERNEL) {
+ (lflags & __GFP_RECLAIM) != __GFP_RECLAIM) {
return (ptr);
}