Commit 8577da6a authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Don't make the slab might_sleep() check dependent on slab debugging

The might_sleep() check in kmm_cache_alloc() is currently disabled if slab
debugging is disabled.

Fix that so it's enabled if might_sleep debugging is enabled.
parent b2e92a52
...@@ -1303,9 +1303,6 @@ static void cache_init_objs (kmem_cache_t * cachep, ...@@ -1303,9 +1303,6 @@ static void cache_init_objs (kmem_cache_t * cachep,
static void kmem_flagcheck(kmem_cache_t *cachep, int flags) static void kmem_flagcheck(kmem_cache_t *cachep, int flags)
{ {
if (flags & __GFP_WAIT)
might_sleep();
if (flags & SLAB_DMA) { if (flags & SLAB_DMA) {
if (!(cachep->gfpflags & GFP_DMA)) if (!(cachep->gfpflags & GFP_DMA))
BUG(); BUG();
...@@ -1595,14 +1592,19 @@ static void* cache_alloc_refill(kmem_cache_t* cachep, int flags) ...@@ -1595,14 +1592,19 @@ static void* cache_alloc_refill(kmem_cache_t* cachep, int flags)
return ac_entry(ac)[--ac->avail]; return ac_entry(ac)[--ac->avail];
} }
static inline void cache_alloc_debugcheck_before(kmem_cache_t *cachep, int flags) static inline void
cache_alloc_debugcheck_before(kmem_cache_t *cachep, int flags)
{ {
if (flags & __GFP_WAIT)
might_sleep();
#if DEBUG #if DEBUG
kmem_flagcheck(cachep, flags); kmem_flagcheck(cachep, flags);
#endif #endif
} }
static inline void *cache_alloc_debugcheck_after (kmem_cache_t *cachep, unsigned long flags, void *objp) static inline void *
cache_alloc_debugcheck_after(kmem_cache_t *cachep,
unsigned long flags, void *objp)
{ {
#if DEBUG #if DEBUG
if (!objp) if (!objp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment