Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Thorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Thorsten Blum and committed by
Andrew Morton
592c9330 073ebebd

+1 -4
+1 -4
lib/test_hmm.c
··· 799 799 unsigned long mapped = 0; 800 800 int i; 801 801 802 - if (end < addr + (ARRAY_SIZE(pages) << PAGE_SHIFT)) 803 - next = end; 804 - else 805 - next = addr + (ARRAY_SIZE(pages) << PAGE_SHIFT); 802 + next = min(end, addr + (ARRAY_SIZE(pages) << PAGE_SHIFT)); 806 803 807 804 ret = make_device_exclusive_range(mm, addr, next, pages, NULL); 808 805 /*