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(); From patchwork Thu Jul 27 01:16:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13328653 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 D4C0EC001DE for ; Thu, 27 Jul 2023 01:16:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D6C56B0074; Wed, 26 Jul 2023 21:16:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 030676B0075; Wed, 26 Jul 2023 21:16:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCB1C8D0003; Wed, 26 Jul 2023 21:16:26 -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 A59636B0074 for ; Wed, 26 Jul 2023 21:16:26 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 78C7114085B for ; Thu, 27 Jul 2023 01:16:26 +0000 (UTC) X-FDA: 81055626372.28.49A6527 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf15.hostedemail.com (Postfix) with ESMTP id EF3B3A0012 for ; Thu, 27 Jul 2023 01:16:22 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.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=1690420584; 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=xYd37JbWctprMIsLniMzviaBXc8Tl5tX0ObDbsc5gGU=; b=A1EJtMyh4nI1657DOTUp24zMExn03FrZwU08ipVuCVumlPAazmfm/FOMXMKIonizuQchVT j8Sb/hPPHSA3ZG8aV4zIMS3t7SzNNoGSxB2BU+tJM/ep7u79R0Jpf9/p7FBv1x93zCycX+ HLCZixiG1G78VSQv4aCbY38GD8pEJ1s= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.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=1690420584; a=rsa-sha256; cv=none; b=qSCth8CYVnXsAgYSFtD9au7Z4+evdcTTpRVhBd7gsfSqLNSZYVm1d8Ttnm0cgI0FUZAu7X UmA9ZvZDuCX6z/H/iRfBTq26Ua3MwIfmXRLM0XScLFBWlttduYxXCw941VZg681X6Xq3oF NIfFAvOcQOPxXdviGYcGQ6Taz2q1ODs= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RBCVF1DzZzTm6Y; Thu, 27 Jul 2023 09:14:45 +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:19 +0800 From: Peng Zhang To: , CC: , , , , , , , ZhangPeng Subject: [PATCH 2/3] mm: kmsan: use helper macro offset_in_page() Date: Thu, 27 Jul 2023 09:16:11 +0800 Message-ID: <20230727011612.2721843-3-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-Server: rspam09 X-Rspamd-Queue-Id: EF3B3A0012 X-Stat-Signature: 9mafub6qj7dgj11ybzcuywtksr8c79bm X-Rspam-User: X-HE-Tag: 1690420582-180379 X-HE-Meta: U2FsdGVkX18l+B+8mnUknSmSPxT/VYFyOrv4ddb6AxnBn8//GWk6dE1gSrj6+nscAZhen+b+K83OdO5GGNjzYE4dtMYgu/lJfB3AI/5tHsgbKIhkoLMqDQ724twQ3rxTO6AbzDwP37/V5g9k8N9eqGJbDk9az8XqlsvZeKOkaQc4tvG+TwnAG7jhGnYdjB+Wm4Yn8B3fRz+d5yP0kmxUxvYy6dS0XFIWusbpwgMoj2eU/Mbkd8w79k982XEhb2MBB6lUtOxRNT+Rj078BDobSEtyx4sOU7/bi8Tw7e+HvtuX44xWIgtN1g0ZGHotlpOiHI6GT0M1vMtUF2D+Ana75TUcwm70wxXUZVTOokRy1UJuNtqnMApvxpiqlEXK/+WCJkgd5kL/jLJ+IFkiR72nfVTUenqj+BnKkxBsiPIZIedWLJDGgCMy909u2tvGr63lFNN0zAmCBQnX/p1oR6IgkrtlFkQlMeIEsBQdcUU8xAi9fr9smOA1u/53nHjrQPsFn8rleYRpTrCbRHuqb0alP3AOARAeV6PXa+Of41183rEZJkV8aOsSGwt1cBRTtpjHa2bl1WO+1Dw8PptrI0WQSS0eV1Obj5b5MhHLZWCzghvh6genKalviV/neOn0HfSOc2wjDqzzknnKwwE9pRFZh7qxCUaOLKXlR6IRKKLGKW/lmkJlyxlo9+PI6C2BaBeM1awtTIZ5Pcq+tYGt3M57zqXoyV/qU81/HDVbOCZ7TkQ52JzHPHZTBP9g5Avo4WGh/4QbICBn701kPSajlKo5K0Ju6JR12OtNl6/QEuB/Dc+D++MEY4n5okvQNYBVkIlDBYU2zrOj3XNJ731n8bb/xAD5NLjgQzfgEg7XAoQeyYMBJgBjq5S6WoyXSTLquCkFrDIvcK8qBKdhNQPwjlfTv+SKtLd+VexHF5qU3yzMPsEdYeEMf9+G6r4ZD2sf3OYv1dp2WEBqsXRvDPX6/3A 28VifDoJ AeYSX6VFSawSk810AIlhSxNGStoESzfuJAEpyVktWRaUe5sPqoGOiCI4jSSp/6JKt8mue24lJVeyZihwyFelyg+b/sZ6vcB4ZBvcjnuQJ0MGTLxS/561JmM4G6qkBVSoN4gr7pl10Q3UMyWL5yK10/shxfioFBxyH5NRbJY3aul/vjupvzLUWjwcBenGHA4qWAYOl 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 helper macro offset_in_page() 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 4e3c3e60ba97..5d6e2dee5692 100644 --- a/mm/kmsan/hooks.c +++ b/mm/kmsan/hooks.c @@ -339,7 +339,7 @@ void kmsan_handle_dma(struct page *page, size_t offset, size_t size, * internal KMSAN checks. */ while (size > 0) { - page_offset = addr % PAGE_SIZE; + page_offset = offset_in_page(addr); to_go = min(PAGE_SIZE - page_offset, (u64)size); kmsan_handle_dma_page((void *)addr, to_go, dir); addr += to_go; diff --git a/mm/kmsan/shadow.c b/mm/kmsan/shadow.c index c7de991f6d7f..966994268a01 100644 --- a/mm/kmsan/shadow.c +++ b/mm/kmsan/shadow.c @@ -145,7 +145,7 @@ void *kmsan_get_metadata(void *address, bool is_origin) return NULL; if (!page_has_metadata(page)) return NULL; - off = addr % PAGE_SIZE; + off = offset_in_page(addr); return (is_origin ? origin_ptr_for(page) : shadow_ptr_for(page)) + off; } From patchwork Thu Jul 27 01:16:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13328652 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 9FB3BC0015E for ; Thu, 27 Jul 2023 01:16:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D7A2D6B0072; Wed, 26 Jul 2023 21:16:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D51108D0001; Wed, 26 Jul 2023 21:16:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B08128D0002; Wed, 26 Jul 2023 21:16:26 -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 A0EE16B0072 for ; Wed, 26 Jul 2023 21:16:26 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6868DB2940 for ; Thu, 27 Jul 2023 01:16:26 +0000 (UTC) X-FDA: 81055626372.27.CD50BC7 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf29.hostedemail.com (Postfix) with ESMTP id 0FDAE120021 for ; Thu, 27 Jul 2023 01:16:23 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@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=1690420584; 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=wdDnXuOYCY6a9cM1iZrK6XAJpPM+qYFvR+jg6Bi7Xzc=; b=YYYk1XrQOucD17FDb9+njwXxeC740wodrL512+p88FuAZ0dXAiS0KUJCJcTl0WeAHsfwu9 sddWFqOBglIkaw/jStvBLsk1ZdPKOny3sTQqGP4+GYwR1z+C3rR0BKhZZgRyZVw5xUb7NX H9jjHWmEr+vA55uQfWurBCUH3DCAVdk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690420584; a=rsa-sha256; cv=none; b=fuyd5FYbP/sHbt9306XXXf404NrDjZEKuFX6VVTHw/2e8keo6eB3jQE7Q64N+Eq5LVu6/J RhzeEmp5d3JBftMRyrY/VFJ69CVsWjg/qjpNngiKxh6HoECJyLmK15Jj9/2rNTKqy4OQSY YO8wEkwTnq6avjwc0h9HXJ6x06OMmJA= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RBCSL0RfCztRjs; Thu, 27 Jul 2023 09:13:06 +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:20 +0800 From: Peng Zhang To: , CC: , , , , , , , ZhangPeng Subject: [PATCH 3/3] mm: kmsan: use helper macros PAGE_ALIGN and PAGE_ALIGN_DOWN Date: Thu, 27 Jul 2023 09:16:12 +0800 Message-ID: <20230727011612.2721843-4-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: 0FDAE120021 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 4odbosyj36u3wspbbgrgan5pn8obri8c X-HE-Tag: 1690420583-268275 X-HE-Meta: U2FsdGVkX193vT6fc8yziNy0196TUAuwia7wk/Dspg3GWgBQCo1qpfFQ1dpBf+W/lDCOtax/aMgaDdnFHZ2IgOCw32LCZ0eQjcDWSTpyAk99x9CrrxkaYnR0xETytZOGOucrUmJoH9dJ9iGvyC3ODOPCz7vQHiAFS9OYb+ubGtAMHxbfVe8SQ46P3RZo/1Zz7zKfGHo8Wcyhd1R8ogGqPBtOG4BOLB7xWS0XhBQeTHelmIByWdE2K2+PU3lG0JxbL1jZqM8s+onvKbTy3mdRCvE+nEW8ZMiHenU4ACSJ25wTSh9g/nk2QLZAomsgVvtPHuNdx2EMJVfJTicpCp0DccyGtfLEdPedXdN1xTmj0m8vvDL78H2DqKWIEWbEQFNv/siCrt3ehe0jvYPiRU0R9OMAvZpErY/e6i6/EBTxeGgdUH5x/b4BnO8HOwiCBQk0LnGcvlzZEqTyBJKwsY8MI1KXU/pnam+WuahOWcvB5IF9EQJz/N7Ihm+TP8Z/tzNkQN61sBOrA4PDtN01mRBlwxM5ncY1fA3unx3dL4knpmCHo6upJkeP5lfbFwPb9eCvWfz1ORHm6Yaugv+xnTXZQEwB4ET9YPmd0eosiLSJYOv6vzKv8m8G6Cif2h45BGpT+lpOyw0BkyHalQhZbnV2M0DBg8xj3GuMrVE3fTs03eR2LwXMnCel6vQ8QMSN/ucCNSSZCOEwz2zTbOl9e4yC21c00Vda2psGfpp5isQpp8bK2JxxJ+vlOuf9kc5eNyWnG//2Hk1MkJtvtu1XkvK4/kym7nSUq7O9qlGiBLJzBOe/4kFuudMfKatQsYS0W3XhFNhr+tPAEwBeNmbnj/poeqfDiRPULF0eQ+8Tk/yLSeLdZtlaf9u9/IcRmqvh6Bkl78qBA6khLCajYJm/eaLgCisT7k/v0rxGD0CYmBBCKypPmCePQsEKI0hoXk0S0kNa0I+vm+Abue37/uReucm zUqnWwy9 C3r8BE1a71iDY2lhC4qcpM6MKSqswa8ItfOFtBQhSzFAVphCmv/jedPtNa8ueJe4RJa3qb06UyTGhQiqmDr3NNsQeRnF+ba68ibeIAL6t5eo1BqpKKtkmY9XfznwVd/uajb7g63U16grfYqT9iq2mI77V9RxymWsgEfhCtMX2TQyyy/CWiVb6FZwYqEZlEFDHZnIK 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 helper macros PAGE_ALIGN and PAGE_ALIGN_DOWN to improve code readability. No functional modification involved. Signed-off-by: ZhangPeng Reviewed-by: Alexander Potapenko --- mm/kmsan/shadow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/kmsan/shadow.c b/mm/kmsan/shadow.c index 966994268a01..87318f9170f1 100644 --- a/mm/kmsan/shadow.c +++ b/mm/kmsan/shadow.c @@ -281,8 +281,8 @@ void __init kmsan_init_alloc_meta_for_range(void *start, void *end) struct page *page; u64 size; - start = (void *)ALIGN_DOWN((u64)start, PAGE_SIZE); - size = ALIGN((u64)end - (u64)start, PAGE_SIZE); + start = (void *)PAGE_ALIGN_DOWN((u64)start); + size = PAGE_ALIGN((u64)end - (u64)start); shadow = memblock_alloc(size, PAGE_SIZE); origin = memblock_alloc(size, PAGE_SIZE); for (u64 addr = 0; addr < size; addr += PAGE_SIZE) {