Thread (17 messages) 17 messages, 6 authors, 2018-12-06

Re: [PATCH 2/3] mm/mmu_notifier: use structure for invalidate_range_start/end calls

flat view

From: Jan Kara <jack@suse.cz>
Date: 2018-12-05 11:04:16
Also in: dri-devel, kvm, linux-fsdevel, linux-mm, lkml

Hi Jerome!

On Mon 03-12-18 15:18:16, jglisse@redhat.com wrote:
From: Jérôme Glisse <redacted>

To avoid having to change many call sites everytime we want to add a
parameter use a structure to group all parameters for the mmu_notifier
invalidate_range_start/end cakks. No functional changes with this
patch.
Two suggestions for the patch below:
quoted hunk ↗ jump to hunk
@@ -772,7 +775,8 @@ static void dax_entry_mkclean(struct address_space *mapping, pgoff_t index,
 		 * call mmu_notifier_invalidate_range_start() on our behalf
 		 * before taking any lock.
 		 */
-		if (follow_pte_pmd(vma->vm_mm, address, &start, &end, &ptep, &pmdp, &ptl))
+		if (follow_pte_pmd(vma->vm_mm, address, &range,
+				   &ptep, &pmdp, &ptl))
 			continue;
The change of follow_pte_pmd() arguments looks unexpected. Why should that
care about mmu notifier range? I see it may be convenient but it doesn't look
like a good API to me.
quoted hunk ↗ jump to hunk
@@ -1139,11 +1140,15 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
 				downgrade_write(&mm->mmap_sem);
 				break;
 			}
-			mmu_notifier_invalidate_range_start(mm, 0, -1);
+
+			range.start = 0;
+			range.end = -1UL;
+			range.mm = mm;
+			mmu_notifier_invalidate_range_start(&range);
Also how about providing initializer for struct mmu_notifier_range? Or
something like DECLARE_MMU_NOTIFIER_RANGE? That will make sure that
unused arguments for particular notification places have defined values and
also if you add another mandatory argument (like you do in your third
patch), you just add another argument to the initializer and that way
the compiler makes sure you haven't missed any place. Finally the code will
remain more compact that way (less lines needed to initialize the struct).

								Honza
-- 
Jan Kara [off-list ref]
SUSE Labs, CR
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help