Re: [PATCH v2 01/24] lockdep: Fix might_fault()

From: David Hildenbrand
Date: Thu Feb 06 2025 - 13:28:36 EST


On 05.02.25 11:21, Peter Zijlstra wrote:
Turns out that commit 9ec23531fd48 ("sched/preempt, mm/fault: Trigger
might_sleep() in might_fault() with disabled pagefaults") accidentally
(and unnessecarily) put the lockdep part of __might_fault() under
CONFIG_DEBUG_ATOMIC_SLEEP.

Cc: David Hildenbrand <david@xxxxxxxxxx>
Fixes: 9ec23531fd48 ("sched/preempt, mm/fault: Trigger might_sleep() in might_fault() with disabled pagefaults")

Heh, that was 10 years ago, part one of my first not-kvm-specific patch series.

Very likely it was not by accident, but I don't have any memory on that part :)

Probably I actually wanted this to be

#if defined(CONFIG_PROVE_LOCKING)

such that the function looked more similar to pre-662bbcb2747c


Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
---
mm/memory.c | 2 --
1 file changed, 2 deletions(-)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -6695,10 +6695,8 @@ void __might_fault(const char *file, int
if (pagefault_disabled())
return;
__might_sleep(file, line);
-#if defined(CONFIG_DEBUG_ATOMIC_SLEEP)
if (current->mm)
might_lock_read(&current->mm->mmap_lock);
-#endif
}
EXPORT_SYMBOL(__might_fault);
#endif




--
Cheers,

David / dhildenb