Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/mempool: use might_alloc()

mempool are generally used for GFP_NOIO, so this wont benefit all that
much because might_alloc currently only checks GFP_NOFS. But it does
validate against mmu notifier pte zapping, some might catch some drivers
doing really silly things, plus it's a bit more meaningful in what we're
checking for here.

Link: https://lkml.kernel.org/r/20220605152539.3196045-3-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Daniel Vetter and committed by
akpm
21bfe8db a3967244

+1 -1
+1 -1
mm/mempool.c
··· 379 379 gfp_t gfp_temp; 380 380 381 381 VM_WARN_ON_ONCE(gfp_mask & __GFP_ZERO); 382 - might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM); 382 + might_alloc(gfp_mask); 383 383 384 384 gfp_mask |= __GFP_NOMEMALLOC; /* don't allocate emergency reserves */ 385 385 gfp_mask |= __GFP_NORETRY; /* don't loop in __alloc_pages */