Commit 592c9330 authored by Thorsten Blum's avatar Thorsten Blum Committed by Andrew Morton
Browse files

lib: test_hmm: use min() to improve dmirror_exclusive()

Use min() to simplify the dmirror_exclusive() function and improve its
readability.

Link: https://lkml.kernel.org/r/20240726131245.161695-1-thorsten.blum@toblux.com


Signed-off-by: default avatarThorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 073ebebd
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -799,10 +799,7 @@ static int dmirror_exclusive(struct dmirror *dmirror,
		unsigned long mapped = 0;
		int i;

		if (end < addr + (ARRAY_SIZE(pages) << PAGE_SHIFT))
			next = end;
		else
			next = addr + (ARRAY_SIZE(pages) << PAGE_SHIFT);
		next = min(end, addr + (ARRAY_SIZE(pages) << PAGE_SHIFT));

		ret = make_device_exclusive_range(mm, addr, next, pages, NULL);
		/*