mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 00:35:01 +00:00
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>
This commit is contained in:
parent
073ebebd18
commit
592c9330e3
@ -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);
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user