From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB6CCC433DB for ; Sun, 7 Feb 2021 02:20:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1D0F964E87 for ; Sun, 7 Feb 2021 02:20:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D0F964E87 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 595466B0006; Sat, 6 Feb 2021 21:20:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5451D6B006C; Sat, 6 Feb 2021 21:20:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 481096B006E; Sat, 6 Feb 2021 21:20:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0187.hostedemail.com [216.40.44.187]) by kanga.kvack.org (Postfix) with ESMTP id 2CB436B0006 for ; Sat, 6 Feb 2021 21:20:38 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E2DB4180AD817 for ; Sun, 7 Feb 2021 02:20:37 +0000 (UTC) X-FDA: 77789868114.03.mark62_4108fab275f2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id C132328A4EC for ; Sun, 7 Feb 2021 02:20:37 +0000 (UTC) X-HE-Tag: mark62_4108fab275f2 X-Filterd-Recvd-Size: 2908 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Sun, 7 Feb 2021 02:20:36 +0000 (UTC) Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DYCWY749czMWBZ; Sun, 7 Feb 2021 10:18:49 +0800 (CST) Received: from [10.174.179.149] (10.174.179.149) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Sun, 7 Feb 2021 10:20:28 +0800 Subject: Re: [PATCH] mm/hugetlb: use helper huge_page_size() to simplify the hugetlb_vm_op_pagesize() To: David Hildenbrand , , CC: , References: <20210205092209.16024-1-linmiaohe@huawei.com> <2743477c-a256-0295-884d-5354c634508d@redhat.com> From: Miaohe Lin Message-ID: <82eecd04-c669-7697-a593-30aedae94a3b@huawei.com> Date: Sun, 7 Feb 2021 10:20:27 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <2743477c-a256-0295-884d-5354c634508d@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US X-Originating-IP: [10.174.179.149] X-CFilter-Loop: Reflected Content-Transfer-Encoding: quoted-printable 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: On 2021/2/6 0:12, David Hildenbrand wrote: > On 05.02.21 10:22, Miaohe Lin wrote: >> We can use helper huge_page_size() to get the size of the pages alloca= ted >> when backing a VMA directly to make the code more simplified. >> >> Signed-off-by: Miaohe Lin >> --- >> =C2=A0 mm/hugetlb.c | 4 +--- >> =C2=A0 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/mm/hugetlb.c b/mm/hugetlb.c >> index 18628f8dbfb0..3eea2a34d9f5 100644 >> --- a/mm/hugetlb.c >> +++ b/mm/hugetlb.c >> @@ -3647,9 +3647,7 @@ static int hugetlb_vm_op_split(struct vm_area_st= ruct *vma, unsigned long addr) >> =C2=A0 =C2=A0 static unsigned long hugetlb_vm_op_pagesize(struct vm_ar= ea_struct *vma) >> =C2=A0 { >> -=C2=A0=C2=A0=C2=A0 struct hstate *hstate =3D hstate_vma(vma); >> - >> -=C2=A0=C2=A0=C2=A0 return 1UL << huge_page_shift(hstate); >> +=C2=A0=C2=A0=C2=A0 return huge_page_size(hstate_vma(vma)); >> =C2=A0 } >=20 > Maybe it makes sense to squash all of these individual patches you send= that do the same things/perform the same cleanups. Shouldn't be to hard = to identify all these cases using simple "git grep". >=20 Many thanks for your advice. I'am studying the mm code and find these cle= anups when I come across these code. I postponed these cleanups but forgot trying to squash the patches that d= o the same things. I would try to identify all the same cases using "git grep" rather than relying on code = review. > Makes life of reviewers and maintainers easier ... >=20 My bad. Sorry. >=20 Thanks again.