Merge branch 'slab/for-6.1/slub_validation_locking' into slab/for-next
A fix for a regression in slub_debug caches that could cause slab page leaks and subsequent warnings on cache shutdown, by Feng Tang.
This commit is contained in:
commit
00a7829ba8
1 changed files with 14 additions and 11 deletions
25
mm/slub.c
25
mm/slub.c
|
@ -2881,22 +2881,25 @@ out:
|
||||||
set_freepointer(s, tail, prior);
|
set_freepointer(s, tail, prior);
|
||||||
slab->freelist = head;
|
slab->freelist = head;
|
||||||
|
|
||||||
/* Do we need to remove the slab from full or partial list? */
|
/*
|
||||||
|
* If the slab is empty, and node's partial list is full,
|
||||||
|
* it should be discarded anyway no matter it's on full or
|
||||||
|
* partial list.
|
||||||
|
*/
|
||||||
|
if (slab->inuse == 0 && n->nr_partial >= s->min_partial)
|
||||||
|
slab_free = slab;
|
||||||
|
|
||||||
if (!prior) {
|
if (!prior) {
|
||||||
|
/* was on full list */
|
||||||
remove_full(s, n, slab);
|
remove_full(s, n, slab);
|
||||||
} else if (slab->inuse == 0 &&
|
if (!slab_free) {
|
||||||
n->nr_partial >= s->min_partial) {
|
add_partial(n, slab, DEACTIVATE_TO_TAIL);
|
||||||
|
stat(s, FREE_ADD_PARTIAL);
|
||||||
|
}
|
||||||
|
} else if (slab_free) {
|
||||||
remove_partial(n, slab);
|
remove_partial(n, slab);
|
||||||
stat(s, FREE_REMOVE_PARTIAL);
|
stat(s, FREE_REMOVE_PARTIAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we need to discard the slab or add to partial list? */
|
|
||||||
if (slab->inuse == 0 && n->nr_partial >= s->min_partial) {
|
|
||||||
slab_free = slab;
|
|
||||||
} else if (!prior) {
|
|
||||||
add_partial(n, slab, DEACTIVATE_TO_TAIL);
|
|
||||||
stat(s, FREE_ADD_PARTIAL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slab_free) {
|
if (slab_free) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue