lkml.org 
[lkml]   [2019]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] pagewalk: use lockdep_assert_held for locking validation
On Thu, Aug 08, 2019 at 06:42:40PM +0300, Christoph Hellwig wrote:
> Use lockdep to check for held locks instead of using home grown
> asserts.
>
> @@ -319,7 +319,7 @@ int walk_page_range(struct mm_struct *mm, unsigned long start,
> if (!walk.mm)
> return -EINVAL;
>
> - VM_BUG_ON_MM(!rwsem_is_locked(&walk.mm->mmap_sem), walk.mm);
> + lockdep_assert_held(&walk.mm->mmap_sem);

It occurs to me that this is exactly the pattern that lockdep_pin_lock()
was designed for. I'm pretty sure things will go badly if any callee
unlocks then relocks the lock.

\
 
 \ /
  Last update: 2019-08-08 20:18    [W:0.473 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site