mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lib: test_hmm: Use min() to improve dmirror_exclusive()
@ 2024-07-26 13:12 Thorsten Blum
  2024-08-01  9:33 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2024-07-26 13:12 UTC (permalink / raw)
  To: jglisse, akpm; +Cc: linux-mm, linux-kernel, Thorsten Blum

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

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 lib/test_hmm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index ee20e1f9bae9..056f2e411d7b 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -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);
 		/*
-- 
2.39.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-01  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-26 13:12 [PATCH] lib: test_hmm: Use min() to improve dmirror_exclusive() Thorsten Blum
2024-08-01  9:33 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®