[PATCH 09/21] mm/page_alloc: Invert is_check_pages_enabled() check

Brendan Jackman posted 21 patches 1 week ago
[PATCH 09/21] mm/page_alloc: Invert is_check_pages_enabled() check
Posted by Brendan Jackman 1 week ago
A later patch will expand this function, making it ugly that the whole
body sits inside a conditional.

In preparation, invert it to de-indent the main logic. Separate commit
to make review easier.

Signed-off-by: Brendan Jackman <jackmanb@google.com>
---
 mm/page_alloc.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a1db87488296a6d2d91a1be8d4d202f1841c4dfd..10757410da2127b0488c99c5933422fc649f9a1d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1752,13 +1752,14 @@ static bool check_new_page(struct page *page)
 
 static inline bool check_new_pages(struct page *page, unsigned int order)
 {
-	if (is_check_pages_enabled()) {
-		for (int i = 0; i < (1 << order); i++) {
-			struct page *p = page + i;
+	if (!is_check_pages_enabled())
+		return false;
 
-			if (check_new_page(p))
-				return true;
-		}
+	for (int i = 0; i < (1 << order); i++) {
+		struct page *p = page + i;
+
+		if (check_new_page(p))
+			return true;
 	}
 
 	return false;

-- 
2.50.1