summaryrefslogtreecommitdiff
path: root/patches/lib-bucket_locks.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/lib-bucket_locks.patch')
-rw-r--r--patches/lib-bucket_locks.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/patches/lib-bucket_locks.patch b/patches/lib-bucket_locks.patch
new file mode 100644
index 00000000..df7420de
--- /dev/null
+++ b/patches/lib-bucket_locks.patch
@@ -0,0 +1,29 @@
+diff --git a/compat/lib-bucket_locks.c b/compat/lib-bucket_locks.c
+index 266a97c5708b..405b52ca5708 100644
+--- a/compat/lib-bucket_locks.c
++++ b/compat/lib-bucket_locks.c
+@@ -30,10 +30,24 @@ int alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *locks_mask,
+ }
+
+ if (sizeof(spinlock_t) != 0) {
++#if LINUX_VERSION_IS_LESS(4,12,0)
++#ifdef CONFIG_NUMA
++ if (size * sizeof(spinlock_t) > PAGE_SIZE &&
++ gfp == GFP_KERNEL)
++ tlocks = vmalloc(size * sizeof(spinlock_t));
++#endif
++ if (gfp != GFP_KERNEL)
++ gfp |= __GFP_NOWARN | __GFP_NORETRY;
++
++ if (!tlocks)
++ tlocks = kmalloc_array(size, sizeof(spinlock_t),
++ gfp);
++#else
+ if (gfpflags_allow_blocking(gfp))
+ tlocks = kvmalloc(size * sizeof(spinlock_t), gfp);
+ else
+ tlocks = kmalloc_array(size, sizeof(spinlock_t), gfp);
++#endif
+ if (!tlocks)
+ return -ENOMEM;
+ for (i = 0; i < size; i++)