From patchwork Tue Sep 13 01:55:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zuoze X-Patchwork-Id: 12974267 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 8124AC6FA83 for ; Tue, 13 Sep 2022 01:55:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EF7398D0001; Mon, 12 Sep 2022 21:55:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA5D86B0073; Mon, 12 Sep 2022 21:55:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6E098D0001; Mon, 12 Sep 2022 21:55: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 C62776B0072 for ; Mon, 12 Sep 2022 21:55:55 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 22EAB808E0 for ; Tue, 13 Sep 2022 01:55:46 +0000 (UTC) X-FDA: 79905395892.26.FAC79ED Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf06.hostedemail.com (Postfix) with ESMTP id 55C84180085 for ; Tue, 13 Sep 2022 01:55:45 +0000 (UTC) Received: from kwepemi500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MRRLj3DM5znV8Z; Tue, 13 Sep 2022 09:53:01 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemi500002.china.huawei.com (7.221.188.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 13 Sep 2022 09:55:40 +0800 From: Ze Zuo To: CC: , , , ze zuo Subject: [PATCH-next] mm/mempolicy: use PAGE_ALIGN instead of open-coding it Date: Tue, 13 Sep 2022 01:55:05 +0000 Message-ID: <20220913015505.1998958-1-zuoze1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500002.china.huawei.com (7.221.188.171) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663034145; a=rsa-sha256; cv=none; b=qdsXJhT1qI251q2Hg3yZqeA9jtCVWblVsH3x+DtTydjCTmjEbPMSS/ChLlNCo46eOK9/OF 52goth4l5ZGo9kgeucs6CWarctoMKWIoLS3y1GjvXB1Wa1+LI0owp8XXMb4uInGK6klAke Ctkt00Dn+cTtZqpix2yWwcBpcWm+aUE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of zuoze1@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zuoze1@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=1663034145; 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=Og0Fs5vgmWeVTY2dTBVvvZ+Nti0n+WrGr4HYT5dQjkM=; b=VjtwLyO/NVMSMn8PIMmkpb6qsKNYMt4dXUZI0vxzuVxaqPOSonRy2FOMPOoFIC0Hn+DSwK ujlRWY4KFMs/ZwEGXUPvxecPPKptzqVZxNtE/F1vwIrvZeqTDEhnqlPAsEFK3P7tvoWe0r en/ukdwDgN9PJh+3J8LkTRiCcJ2rZU0= X-Stat-Signature: rb7ysi65cxqae7fwqn71itq8k1qsernk X-Rspamd-Queue-Id: 55C84180085 Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of zuoze1@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zuoze1@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1663034145-113461 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: ze zuo Replace the simple calculation with PAGE_ALIGN. Signed-off-by: ze zuo Reviewed-by: Muchun Song --- mm/mempolicy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 143e2eaaa6ec..a937eaec5b68 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1270,7 +1270,7 @@ static long do_mbind(unsigned long start, unsigned long len, if (mode == MPOL_DEFAULT) flags &= ~MPOL_MF_STRICT; - len = (len + PAGE_SIZE - 1) & PAGE_MASK; + len = PAGE_ALIGN(len); end = start + len; if (end < start) @@ -1507,7 +1507,7 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le if (home_node >= MAX_NUMNODES || !node_online(home_node)) return -EINVAL; - len = (len + PAGE_SIZE - 1) & PAGE_MASK; + len = PAGE_ALIGN(len); end = start + len; if (end < start)