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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 AD4AAC433DB for ; Mon, 15 Mar 2021 02:05:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7950664E46 for ; Mon, 15 Mar 2021 02:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbhCOCEk (ORCPT ); Sun, 14 Mar 2021 22:04:40 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:14335 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbhCOCEi (ORCPT ); Sun, 14 Mar 2021 22:04:38 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4DzKSF3ByZz8yPD; Mon, 15 Mar 2021 10:02:37 +0800 (CST) Received: from [10.174.177.131] (10.174.177.131) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Mon, 15 Mar 2021 10:04:24 +0800 Subject: Re: [PATCH 1/6] mm/huge_memory.c: rework the function vma_adjust_trans_huge() To: Matthew Wilcox CC: , , , , , , , , , , , , References: <20210313103225.16607-1-linmiaohe@huawei.com> <20210313103225.16607-2-linmiaohe@huawei.com> <20210313200359.GL2577561@casper.infradead.org> From: Miaohe Lin Message-ID: <641f4d6d-97d2-63a8-c61b-a42f71dcba6c@huawei.com> Date: Mon, 15 Mar 2021 10:04:23 +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: <20210313200359.GL2577561@casper.infradead.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.131] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi: On 2021/3/14 4:03, Matthew Wilcox wrote: > On Sat, Mar 13, 2021 at 05:32:19AM -0500, Miaohe Lin wrote: >> +static inline void try_to_split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address) >> +{ >> + if (address & ~HPAGE_PMD_MASK && >> + range_in_vma(vma, address & HPAGE_PMD_MASK, >> + (address & HPAGE_PMD_MASK) + HPAGE_PMD_SIZE)) >> + split_huge_pmd_address(vma, address, false, NULL); >> +} > > This isn't "try to split". This is "split if needed". I think the > comments also need to be moved up here. > Make sense. Would do it in v2! Thanks! > I'm not even sure this is really an improvement. > . > At least we can eliminate a couple of duplicated lines and use helper range_in_vma() to improve the readability slightly. Right? :)