summaryrefslogtreecommitdiff
path: root/include/linux/units.h
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2021-05-22 02:59:38 +0300
committerVlastimil Babka <vbabka@suse.cz>2021-09-04 11:22:01 +0300
commitbd0e7491a931f5a2960555b10b9551464ff8cc8e (patch)
tree5a6be42db208b56198676c4b68655a48e508d695 /include/linux/units.h
parent25c00c506e8176d03f9ad821cc349230dfb5dc1a (diff)
downloadlinux-bd0e7491a931f5a2960555b10b9551464ff8cc8e.tar.xz
mm, slub: convert kmem_cpu_slab protection to local_lock
Embed local_lock into struct kmem_cpu_slab and use the irq-safe versions of local_lock instead of plain local_irq_save/restore. On !PREEMPT_RT that's equivalent, with better lockdep visibility. On PREEMPT_RT that means better preemption. However, the cost on PREEMPT_RT is the loss of lockless fast paths which only work with cpu freelist. Those are designed to detect and recover from being preempted by other conflicting operations (both fast or slow path), but the slow path operations assume they cannot be preempted by a fast path operation, which is guaranteed naturally with disabled irqs. With local locks on PREEMPT_RT, the fast paths now also need to take the local lock to avoid races. In the allocation fastpath slab_alloc_node() we can just defer to the slowpath __slab_alloc() which also works with cpu freelist, but under the local lock. In the free fastpath do_slab_free() we have to add a new local lock protected version of freeing to the cpu freelist, as the existing slowpath only works with the page freelist. Also update the comment about locking scheme in SLUB to reflect changes done by this series. [ Mike Galbraith <efault@gmx.de>: use local_lock() without irq in PREEMPT_RT scope; debugging of RT crashes resulting in put_cpu_partial() locking changes ] Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'include/linux/units.h')
0 files changed, 0 insertions, 0 deletions