mm, slub: do initial checks in ___slab_alloc() with irqs enabled
authorVlastimil Babka <vbabka@suse.cz>
Sat, 8 May 2021 00:28:02 +0000 (02:28 +0200)
committerVlastimil Babka <vbabka@suse.cz>
Fri, 3 Sep 2021 23:12:21 +0000 (01:12 +0200)
commit0b303fb402862dcb7948eeeed2439bd8c99948b5
treecf582cf0547f8120a341b4e56cda547e0fac0d1d
parente500059ba55268e1c5212632e4f21e45f54dc6d9
mm, slub: do initial checks in ___slab_alloc() with irqs enabled

As another step of shortening irq disabled sections in ___slab_alloc(), delay
disabling irqs until we pass the initial checks if there is a cached percpu
slab and it's suitable for our allocation.

Now we have to recheck c->page after actually disabling irqs as an allocation
in irq handler might have replaced it.

Because we call pfmemalloc_match() as one of the checks, we might hit
VM_BUG_ON_PAGE(!PageSlab(page)) in PageSlabPfmemalloc in case we get
interrupted and the page is freed. Thus introduce a pfmemalloc_match_unsafe()
variant that lacks the PageSlab check.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
include/linux/page-flags.h
mm/slub.c