Commit eecd7cb
committed
slab: fix slab accounting imbalance due to defer_deactivate_slab()
Since commit af92793 ("slab: Introduce kmalloc_nolock() and
kfree_nolock().") there's a possibility in alloc_single_from_new_slab()
that we discard the newly allocated slab if we can't spin and we fail to
trylock. As a result we don't perform inc_slabs_node() later in the
function. Instead we perform a deferred deactivate_slab() which can
either put the unacounted slab on partial list, or discard it
immediately while performing dec_slabs_node(). Either way will cause an
accounting imbalance.
Fix this by not marking the slab as frozen, and using free_slab()
instead of deactivate_slab() for non-frozen slabs in
free_deferred_objects(). For CONFIG_SLUB_TINY, that's the only possible
case. By not using discard_slab() we avoid dec_slabs_node().
Fixes: af92793 ("slab: Introduce kmalloc_nolock() and kfree_nolock().")
Link: https://patch.msgid.link/[email protected]
Reviewed-by: Harry Yoo <[email protected]>
Signed-off-by: Vlastimil Babka <[email protected]>1 parent 6ed8bfd commit eecd7cb
1 file changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3422 | 3422 | | |
3423 | 3423 | | |
3424 | 3424 | | |
3425 | | - | |
3426 | 3425 | | |
3427 | 3426 | | |
3428 | 3427 | | |
| |||
6471 | 6470 | | |
6472 | 6471 | | |
6473 | 6472 | | |
6474 | | - | |
| 6473 | + | |
6475 | 6474 | | |
6476 | | - | |
| 6475 | + | |
| 6476 | + | |
| 6477 | + | |
| 6478 | + | |
6477 | 6479 | | |
6478 | 6480 | | |
6479 | 6481 | | |
| |||
0 commit comments