[PATCH 04/65] mm: Extract might_alloc() debug check

Vlastimil Babka vbabka at suse.cz
Fri Oct 23 14:14:21 UTC 2020


On 10/23/20 2:21 PM, Daniel Vetter wrote:
> Extracted from slab.h, which seems to have the most complete version
> including the correct might_sleep() check. Roll it out to slob.c.
> 
> Motivated by a discussion with Paul about possibly changing call_rcu
> behaviour to allocate memory, but only roughly every 500th call.
> 
> There are a lot fewer places in the kernel that care about whether
> allocating memory is allowed or not (due to deadlocks with reclaim
> code) than places that care whether sleeping is allowed. But debugging
> these also tends to be a lot harder, so nice descriptive checks could
> come in handy. I might have some use eventually for annotations in
> drivers/gpu.
> 
> Note that unlike fs_reclaim_acquire/release gfpflags_allow_blocking
> does not consult the PF_MEMALLOC flags. But there is no flag
> equivalent for GFP_NOWAIT, hence this check can't go wrong due to
> memalloc_no*_save/restore contexts.
> 
> Cc: Paul E. McKenney <paulmck at kernel.org>
> Cc: Christoph Lameter <cl at linux.com>
> Cc: Pekka Enberg <penberg at kernel.org>
> Cc: David Rientjes <rientjes at google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim at lge.com>
> Cc: Andrew Morton <akpm at linux-foundation.org>
> Cc: Peter Zijlstra <peterz at infradead.org>
> Cc: Ingo Molnar <mingo at kernel.org>
> Cc: Vlastimil Babka <vbabka at suse.cz>
> Cc: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> Cc: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
> Cc: Michel Lespinasse <walken at google.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: Waiman Long <longman at redhat.com>
> Cc: Thomas Gleixner <tglx at linutronix.de>
> Cc: Randy Dunlap <rdunlap at infradead.org>
> Cc: linux-mm at kvack.org
> Cc: linux-fsdevel at vger.kernel.org
> Cc: Dave Chinner <david at fromorbit.com>
> Cc: Qian Cai <cai at lca.pw>
> Cc: linux-xfs at vger.kernel.org
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>

Looks useful.
Acked-by: Vlastimil Babka <vbabka at suse.cz>


More information about the dri-devel mailing list