From: Jason Gunthorpe Date: Thu, 23 May 2019 14:23:30 +0000 (-0300) Subject: mm/hmm: Use lockdep instead of comments X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8a1a0cd0b770a0f40a49db923479879fa7135aae;p=linux.git mm/hmm: Use lockdep instead of comments So we can check locking at runtime. Signed-off-by: Jason Gunthorpe Reviewed-by: Jérôme Glisse Reviewed-by: John Hubbard Reviewed-by: Ralph Campbell Acked-by: Souptick Joarder Reviewed-by: Christoph Hellwig Tested-by: Philip Yang --- diff --git a/mm/hmm.c b/mm/hmm.c index 1eddda45cefae..6f5dc6d568feb 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -246,11 +246,11 @@ static const struct mmu_notifier_ops hmm_mmu_notifier_ops = { * * To start mirroring a process address space, the device driver must register * an HMM mirror struct. - * - * THE mm->mmap_sem MUST BE HELD IN WRITE MODE ! */ int hmm_mirror_register(struct hmm_mirror *mirror, struct mm_struct *mm) { + lockdep_assert_held_exclusive(&mm->mmap_sem); + /* Sanity check */ if (!mm || !mirror || !mirror->ops) return -EINVAL;