Skip to content

Commit

Permalink
mm, slab: lock the correct nodelist after reenabling irqs
Browse files Browse the repository at this point in the history
cache_grow() can reenable irqs so the cpu (and node) can change, so ensure
that we take list_lock on the correct nodelist.

This fixes an issue with commit 072bb0a ("mm: sl[au]b: add
knowledge of PFMEMALLOC reserve pages") where list_lock for the wrong
node was taken after growing the cache.

Reported-and-tested-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Rientjes authored and Linus Torvalds committed Aug 29, 2012
1 parent c182ae4 commit 51cd8e6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -3260,6 +3260,7 @@ static void *cache_alloc_refill(struct kmem_cache *cachep, gfp_t flags,

/* cache_grow can reenable interrupts, then ac could change. */
ac = cpu_cache_get(cachep);
node = numa_mem_id();

/* no objects in sight? abort */
if (!x && (ac->avail == 0 || force_refill))
Expand Down

0 comments on commit 51cd8e6

Please sign in to comment.