From patchwork Thu Jul 27 01:16:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13328655 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 D6B7DC00528 for ; Thu, 27 Jul 2023 01:16:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BFE16B0078; Wed, 26 Jul 2023 21:16:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 86F4E8D0001; Wed, 26 Jul 2023 21:16:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7103F6B007D; Wed, 26 Jul 2023 21:16:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4A2496B0078 for ; Wed, 26 Jul 2023 21:16:27 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 215C0120426 for ; Thu, 27 Jul 2023 01:16:27 +0000 (UTC) X-FDA: 81055626414.24.EA37226 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf14.hostedemail.com (Postfix) with ESMTP id D0F5B100009 for ; Thu, 27 Jul 2023 01:16:22 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690420585; 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:in-reply-to:references:references; bh=Qr170MEKVVrnU+3V9UPTmGiI7GCaB3XFhNvWhXebk90=; b=SNGA472QVCqCOaUA9sRmZgAwd7bRA1qdbnNt5aaDYpi0nZHncEzuvprbQUhnEpjplvR7C4 muWXEE/9t4/uGtzfOZTa+SSWolVbPaeSf/OY6H+FCvKd/i/rVpBCPTf/JW+RQGLPyPkdOp NRIoFuAfYEZzB9mZkM404SxXX0vGjS8= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690420585; a=rsa-sha256; cv=none; b=IlQ1au3OKSNlmTHGwOY/A0PkyCBqi0gKZ0s9/gLdDPYloMrK1ElBtAC88wQhZY0ozatiys sf6ElJsy7M9NWv6vexthPHOp/hiEnML1Krn8BKcBSa+MepSoCkDRMqSD3fmv28Mt14ZsDf ZANL9H79QytRvNpuREGY1y5QkNXd5Z0= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RBCS81PHgzNmcJ; Thu, 27 Jul 2023 09:12:56 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 27 Jul 2023 09:16:18 +0800 From: Peng Zhang To: , CC: , , , , , , , ZhangPeng Subject: [PATCH 1/3] mm: kmsan: use helper function page_size() Date: Thu, 27 Jul 2023 09:16:10 +0800 Message-ID: <20230727011612.2721843-2-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230727011612.2721843-1-zhangpeng362@huawei.com> References: <20230727011612.2721843-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: D0F5B100009 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: a3cobdtwpj3in6bogzdfgtn8kusuexrn X-HE-Tag: 1690420582-691558 X-HE-Meta: U2FsdGVkX18JX/xvUAZXR3YxIxAUtpgHzsdqWJAZj9ow8iY1IAZvAbEkNNicxVWbizZ05+v3/b3zX9AhibAwkrcHvsZGS7eInand+FCbEjj8OO+RGH1ajIjuICBqagQoa8AkClbTLMr3Qc2I9W/As9hZfRSGvndwElPm94RGrzDth2Fqvo4ygfeisyTiKY+DtSvifqHvYaUFE4nTf27ft8JfeYobgBsR2c4gCJV+CdknZg3R1aiiMns+WqJrZ3p5CkRAYoWJGIbXW+wPU3EvcKi/b63BP+datHkF/XEDKZ8pKVYFMOCH9y3gzgZPxUVI+12M6cRn7yU9O7Iny41DTNHmHuT7yv7rTIvoZrm3MRAP2V4H8W9NteMXH7l6fV43by21Rqza8BQhl4GTjv+tG4TR97SaSdKqCIBDompivf7n0Sg4ZtpjnOimwqg+hcFATzXirNI10jnuZT/ONskIwbsh8vU+uzAeFwVw86tntmg9PYpiydG+JNv84kkty3W1S9asDRilmUTuLwlp0c3tkNVwAmdJzkjC876CaTBlxsp5ViKZbskwynfObK1QnOscZrYqdlSjzUSVAXM5s8gvVcFWMLcD6SYLfizVUXmJWiQQKDjlYslOdvGx4HbjWXGvGj1Xcru7O5yS4FJXTbz0kO8nUeiNmnQd5nsSWzMlbHrSiQ0nXiBMcIXIpCh0toeuDAxGFvUGyyCnvH02usR7JX9cCYIwhASfnSjgOtETwqE6aG+ImctNSWGixz1Gt+bhhTB+L/UiuydRc1UCoQ6Jb0jsKxwzf7HNKMt8Qkly6rgjv1ZPAdlmve8P/L2Rz5u0oIj9dcZ7CLt88ahnaKUMXHHnWxt7NEueH4n02TEiGSDx5zGzZLQQydV4scwPRCQTNCCvhC72Lg7fwMD15ucy30Q27mJGU3jwJok4zIs5wsca3jek7OelrcNdNNitkIGwVzjICibopFoHORA7dds iPpVxFX5 h5wIUdlIyx1GBjPweYVGhXOq6VVaEHGHyCut6X2k4JWm+bMKnO4Y5ha1LeUX+Y/jvF+POxJMwksmB9hoiPJ/Q+yPZPCuxXip/a3nq5vsUy+SmI5mMoCG2SRCORrY573kdnIXYUbKbywMxF1B4DmXb9A3g2Cj3LqZiOtY65VuGGCvq2QuEPsvZgBZYfhBkFZPrg+Nq 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: From: ZhangPeng Use function page_size() to improve code readability. No functional modification involved. Signed-off-by: ZhangPeng Reviewed-by: Alexander Potapenko --- mm/kmsan/hooks.c | 2 +- mm/kmsan/shadow.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/kmsan/hooks.c b/mm/kmsan/hooks.c index ec0da72e65aa..4e3c3e60ba97 100644 --- a/mm/kmsan/hooks.c +++ b/mm/kmsan/hooks.c @@ -117,7 +117,7 @@ void kmsan_kfree_large(const void *ptr) page = virt_to_head_page((void *)ptr); KMSAN_WARN_ON(ptr != page_address(page)); kmsan_internal_poison_memory((void *)ptr, - PAGE_SIZE << compound_order(page), + page_size(page), GFP_KERNEL, KMSAN_POISON_CHECK | KMSAN_POISON_FREE); kmsan_leave_runtime(); diff --git a/mm/kmsan/shadow.c b/mm/kmsan/shadow.c index b8bb95eea5e3..c7de991f6d7f 100644 --- a/mm/kmsan/shadow.c +++ b/mm/kmsan/shadow.c @@ -210,7 +210,7 @@ void kmsan_free_page(struct page *page, unsigned int order) return; kmsan_enter_runtime(); kmsan_internal_poison_memory(page_address(page), - PAGE_SIZE << compound_order(page), + page_size(page), GFP_KERNEL, KMSAN_POISON_CHECK | KMSAN_POISON_FREE); kmsan_leave_runtime();