From patchwork Wed Aug 21 07:53:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 13770977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF4D5C52D6F for ; Wed, 21 Aug 2024 07:54:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 767BE6B00BB; Wed, 21 Aug 2024 03:54:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7174E6B00BC; Wed, 21 Aug 2024 03:54:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 606726B00BD; Wed, 21 Aug 2024 03:54:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 428BA6B00BB for ; Wed, 21 Aug 2024 03:54:55 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E1DB2A8406 for ; Wed, 21 Aug 2024 07:54:54 +0000 (UTC) X-FDA: 82475491308.24.92BC2C8 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf03.hostedemail.com (Postfix) with ESMTP id CE0A820023 for ; Wed, 21 Aug 2024 07:54:51 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of thunder.leizhen@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=thunder.leizhen@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724226813; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=Qn8EIgH82Dxq3OogDJSqHMjjHftODF6FMCKB0r5kwyI=; b=f/rHVD1Uqa8P17L/SyKm4fJQMrXCwZ/CoGkvOnPTu+VjOjdp3T9KSHwacvRos+fO/0MRyi bZvO67zxlYUYyXmNqyoRoAkirklL6XIfAXxuqPlQqioqveOLJ6P+QdmwFNrnkKufo9BUlq Om9sNHT3SoOs0R/3CCm5Qo6JzJonWvQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724226813; a=rsa-sha256; cv=none; b=xNq5ENthyLbzCqDVGnabDZDf820RbCThBzCWzh6jQxjZl2af250JHGVY6e8hNj+a57VWfO ceSfDEob1TaoVB0DKGvf38Ow1kIwPWWuZp+mf0fuptX6DcyUG9i+VmKBs9+UWPMPetBxIf L5n32FQOxAB2lmpN3JdJhwOYxqmYBc4= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of thunder.leizhen@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=thunder.leizhen@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Wpdq3022DzhY1k; Wed, 21 Aug 2024 15:52:47 +0800 (CST) Received: from dggpemf100006.china.huawei.com (unknown [7.185.36.228]) by mail.maildlp.com (Postfix) with ESMTPS id 81A0618009B; Wed, 21 Aug 2024 15:54:47 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemf100006.china.huawei.com (7.185.36.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 21 Aug 2024 15:54:47 +0800 From: Zhen Lei To: Andrew Morton , , CC: Zhen Lei Subject: [PATCH 1/1] mm/page_poison: slightly optimize check_poison_mem() Date: Wed, 21 Aug 2024 15:53:11 +0800 Message-ID: <20240821075311.1953-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.37.3.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.178.55] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemf100006.china.huawei.com (7.185.36.228) X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: CE0A820023 X-Stat-Signature: e9cdeukw3dswhbnpwrpukh8depzkwrnj X-HE-Tag: 1724226891-516549 X-HE-Meta: U2FsdGVkX19zZ+Gj0xEmH4x9C5RVIi+XyXT/cACEdohNkLE1nfxEp/hQB27ZT4NkESi7XTD1QmnkVO+zLqOhS+Fu13uzgxc/x2wcVkIAvh3SLR0+00QjSpylmmh1h9XDHxN/9rv2dxuR0WPjKxYQekpDPnTId3OQdhSC1m4YRYSkjIErdoBca0ThkU4U2I9qIUpvI8c4u3Q2QeE0d9+ejWZpa4/QwpUXcwnS3hv8UDoZDWn18VH5ytjN5hoLyy6sQs2v4xXBNB6AyESS8yalbENEvOMw2ydILl0y94WzSj5efCjIQpAVOw2pb95ZoEyUQbpXihRIBSuk6prP3AU/DrfeAE21JNyNNt9xAQrshzCI5CavK6/1I4foK2+u1vhsENR7vknNmN0KVwZzMtlN2gU2PmlEIN0gnLFwSDXcFvmmKoMe3J2bfKi0RSFjSYUNsUeqJ5k8GmENnae7+yK9rhHJYhV7k8KTcYSNHwZi1hnjsPih9ioWmtbkmocj3sbDMn6iwkwlCy8tkYTa/m35Me8R8pwYOTLPDA6HHLd7uhTKXTyGbYwSDOGtSjYegA7jTKqNEczObkKgYBStFFxobCzA+14vjb8bkhlr3i57f5N6j2wwwDmfueoCm4QBt7UOwkjML6WzEychlWRQ/hey90FmZqXTqGDABNsADlsOASZEV+grEqFoifS+7h8EqgTWB9kK29vtDJDgetQ5IJtHq2s4P3JsdRPV6Efo1+yOvZejwqrn+CK2rPMXSHpoMwaIZcPeZ/6A3n3u5AB0V0atgUQHN6WuPovopgaub/pMlrLOe0KKrz78V2yN6XU167zzRNS1oNkQjBMum1Hy2DxanM7dnA8knoLmZSoFnBFtdhjhoJSkoKTqr1kCcSyTuMaAMWX/YEpiuPCshgG0Txwc4g5ESsKSsnFIMzSsKR2TYapPeCqcCLI6hO0/G1/dn6m8TUHSTiGpeAWQFXrMXB7 JW2CRW4a OTSWXOU0imom4QLNq4YB/Xb3nVP+3GB6oX0hlEva9EdVFzC12Ht06uAs8YIlZfntvhD8dKs0w+9RfTe7ObvlFQ8kFQGhAdLNLph2YlG81xOT4/vAi4x8ZFs38iDirKV1Znwg6JfLXdXFq6Z6HBGCTg6M7jQ2TGBApp2RdMY8vlvII2WqeUH6uYL5v3yKhZLvUfzb1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 --- 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");