aboutsummaryrefslogtreecommitdiffstats
path: root/features/rt/mm-slub-Enable-irqs-for-__GFP_WAIT.patch
diff options
context:
space:
mode:
Diffstat (limited to 'features/rt/mm-slub-Enable-irqs-for-__GFP_WAIT.patch')
-rw-r--r--features/rt/mm-slub-Enable-irqs-for-__GFP_WAIT.patch76
1 files changed, 76 insertions, 0 deletions
diff --git a/features/rt/mm-slub-Enable-irqs-for-__GFP_WAIT.patch b/features/rt/mm-slub-Enable-irqs-for-__GFP_WAIT.patch
new file mode 100644
index 00000000..82d38ebf
--- /dev/null
+++ b/features/rt/mm-slub-Enable-irqs-for-__GFP_WAIT.patch
@@ -0,0 +1,76 @@
+From 9a1bfa7cf125b54a5ad856c32adf4a21359db777 Mon Sep 17 00:00:00 2001
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Wed, 9 Jan 2013 12:08:15 +0100
+Subject: [PATCH 106/191] mm: slub: Enable irqs for __GFP_WAIT
+
+SYSTEM_RUNNING might be too late for enabling interrupts. Allocations
+with GFP_WAIT can happen before that. So use this as an indicator.
+
+[bigeasy: Add warning on RT for allocations in atomic context.
+ Don't enable interrupts on allocations during SYSTEM_SUSPEND. This is done
+ during suspend by ACPI, noticed by Liwei Song <liwei.song@windriver.com>
+]
+
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ mm/slub.c | 18 +++++++++++++++++-
+ 1 file changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/mm/slub.c b/mm/slub.c
+index 863b0304b229..1382845c3802 100644
+--- a/mm/slub.c
++++ b/mm/slub.c
+@@ -1759,10 +1759,18 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
+ void *start, *p, *next;
+ int idx;
+ bool shuffle;
++ bool enableirqs = false;
+
+ flags &= gfp_allowed_mask;
+
+ if (gfpflags_allow_blocking(flags))
++ enableirqs = true;
++
++#ifdef CONFIG_PREEMPT_RT
++ if (system_state > SYSTEM_BOOTING && system_state < SYSTEM_SUSPEND)
++ enableirqs = true;
++#endif
++ if (enableirqs)
+ local_irq_enable();
+
+ flags |= s->allocflags;
+@@ -1823,7 +1831,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
+ page->frozen = 1;
+
+ out:
+- if (gfpflags_allow_blocking(flags))
++ if (enableirqs)
+ local_irq_disable();
+ if (!page)
+ return NULL;
+@@ -2823,6 +2831,10 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s,
+ unsigned long tid;
+ struct obj_cgroup *objcg = NULL;
+
++ if (IS_ENABLED(CONFIG_PREEMPT_RT) && IS_ENABLED(CONFIG_DEBUG_ATOMIC_SLEEP))
++ WARN_ON_ONCE(!preemptible() &&
++ (system_state > SYSTEM_BOOTING && system_state < SYSTEM_SUSPEND));
++
+ s = slab_pre_alloc_hook(s, &objcg, 1, gfpflags);
+ if (!s)
+ return NULL;
+@@ -3304,6 +3316,10 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size,
+ int i;
+ struct obj_cgroup *objcg = NULL;
+
++ if (IS_ENABLED(CONFIG_PREEMPT_RT) && IS_ENABLED(CONFIG_DEBUG_ATOMIC_SLEEP))
++ WARN_ON_ONCE(!preemptible() &&
++ (system_state > SYSTEM_BOOTING && system_state < SYSTEM_SUSPEND));
++
+ /* memcg and kmem_cache debug support */
+ s = slab_pre_alloc_hook(s, &objcg, size, flags);
+ if (unlikely(!s))
+--
+2.19.1
+