Skip to content

Commit

Permalink
mm/slub.c: remove validation on cpu_slab in __flush_cpu_slab()
Browse files Browse the repository at this point in the history
cpu_slab is a per cpu variable which is allocated in all or none.  If a
cpu_slab failed to be allocated, the slub is not usable.

We could use cpu_slab without validation in __flush_cpu_slab().

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Wei Yang <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
RichardWeiYang authored and torvalds committed Dec 28, 2018
1 parent 221d7da commit 1265ef2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2317,12 +2317,10 @@ static inline void __flush_cpu_slab(struct kmem_cache *s, int cpu)
{
struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu);

if (likely(c)) {
if (c->page)
flush_slab(s, c);
if (c->page)
flush_slab(s, c);

unfreeze_partials(s, c);
}
unfreeze_partials(s, c);
}

static void flush_cpu_slab(void *d)
Expand Down

0 comments on commit 1265ef2

Please sign in to comment.