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) {