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.3 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 34BF3C433B4 for ; Wed, 28 Apr 2021 03:03:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A330361407 for ; Wed, 28 Apr 2021 03:03:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A330361407 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0A03D6B0036; Tue, 27 Apr 2021 23:03:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0283E6B006E; Tue, 27 Apr 2021 23:03:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE4B16B0070; Tue, 27 Apr 2021 23:03:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id BF8346B0036 for ; Tue, 27 Apr 2021 23:03:21 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 65F4B8249980 for ; Wed, 28 Apr 2021 03:03:21 +0000 (UTC) X-FDA: 78080279802.24.4FBFF20 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf02.hostedemail.com (Postfix) with ESMTP id B593E40002C0 for ; Wed, 28 Apr 2021 03:02:50 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CBC521FB; Tue, 27 Apr 2021 20:03:19 -0700 (PDT) Received: from [10.163.76.81] (unknown [10.163.76.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E6B423F694; Tue, 27 Apr 2021 20:03:14 -0700 (PDT) From: Anshuman Khandual Subject: Re: [PATCH 1/5] mm/huge_memory.c: remove dedicated macro HPAGE_CACHE_INDEX_MASK To: Miaohe Lin , akpm@linux-foundation.org Cc: ziy@nvidia.com, william.kucharski@oracle.com, willy@infradead.org, yang.shi@linux.alibaba.com, aneesh.kumar@linux.ibm.com, rcampbell@nvidia.com, songliubraving@fb.com, kirill.shutemov@linux.intel.com, riel@surriel.com, hannes@cmpxchg.org, minchan@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20210427133214.2270207-1-linmiaohe@huawei.com> <20210427133214.2270207-2-linmiaohe@huawei.com> Message-ID: Date: Wed, 28 Apr 2021 08:34:06 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210427133214.2270207-2-linmiaohe@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: B593E40002C0 X-Stat-Signature: bdxpo38abqdcwnieo5u1fa8tkzc4xirc X-Rspamd-Server: rspam02 Received-SPF: none (arm.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=foss.arm.com; client-ip=217.140.110.172 X-HE-DKIM-Result: none/none X-HE-Tag: 1619578970-840573 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 4/27/21 7:02 PM, Miaohe Lin wrote: > Rewrite the pgoff checking logic to remove macro HPAGE_CACHE_INDEX_MASK > which is only used here to simplify the code. > > Signed-off-by: Miaohe Lin > --- > include/linux/huge_mm.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h > index 9626fda5efce..0a526f211fec 100644 > --- a/include/linux/huge_mm.h > +++ b/include/linux/huge_mm.h > @@ -152,15 +152,13 @@ static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma) > > bool transparent_hugepage_enabled(struct vm_area_struct *vma); > > -#define HPAGE_CACHE_INDEX_MASK (HPAGE_PMD_NR - 1) > - > static inline bool transhuge_vma_suitable(struct vm_area_struct *vma, > unsigned long haddr) > { > /* Don't have to check pgoff for anonymous vma */ > if (!vma_is_anonymous(vma)) { > - if (((vma->vm_start >> PAGE_SHIFT) & HPAGE_CACHE_INDEX_MASK) != > - (vma->vm_pgoff & HPAGE_CACHE_INDEX_MASK)) > + if (!IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff, > + HPAGE_PMD_NR)) > return false; > } > > LGTM Reviewed-by: Anshuman Khandual