Skip to content

Commit

Permalink
lib: test_hmm: use min() to improve dmirror_exclusive()
Browse files Browse the repository at this point in the history
Use min() to simplify the dmirror_exclusive() function and improve its
readability.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Thorsten Blum <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
Cc: Jérôme Glisse <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
toblux authored and akpm00 committed Sep 2, 2024
1 parent 073ebeb commit 592c933
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/test_hmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
/*
Expand Down

0 comments on commit 592c933

Please sign in to comment.