[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240821075311.1953-1-thunder.leizhen@huawei.com>
Date: Wed, 21 Aug 2024 15:53:11 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Andrew Morton <akpm@...ux-foundation.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>
CC: Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH 1/1] mm/page_poison: slightly optimize check_poison_mem()
When the debug information needs to be suppressed due to ratelimit,
it is unnecessary to determine the end of the corrupted memory.
Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
mm/page_poison.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/mm/page_poison.c b/mm/page_poison.c
index 3e9037363cf9d85..23fa799214720f1 100644
--- a/mm/page_poison.c
+++ b/mm/page_poison.c
@@ -55,14 +55,15 @@ static void check_poison_mem(struct page *page, unsigned char *mem, size_t bytes
if (!start)
return;
+ if (!__ratelimit(&ratelimit))
+ return;
+
for (end = mem + bytes - 1; end > start; end--) {
if (*end != PAGE_POISON)
break;
}
- if (!__ratelimit(&ratelimit))
- return;
- else if (start == end && single_bit_flip(*start, PAGE_POISON))
+ if (start == end && single_bit_flip(*start, PAGE_POISON))
pr_err("pagealloc: single bit error\n");
else
pr_err("pagealloc: memory corruption\n");
--
2.34.1
Powered by blists - more mailing lists