From: Miaohe Lin <linmiaohe@huawei.com>
To: David Hildenbrand <david@redhat.com>, <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>
Subject: Re: [PATCH v2 1/5] mm/huge_memory.c: remove dedicated macro HPAGE_CACHE_INDEX_MASK
Date: Fri, 30 Apr 2021 09:39:29 +0800 [thread overview]
Message-ID: <cb8c3df7-92e1-bce6-9268-12fc10797e23@huawei.com> (raw)
In-Reply-To: <c7dab2a5-cf77-a1dd-201a-f4a5f190c4d7@redhat.com>
On 2021/4/29 22:48, David Hildenbrand wrote:
> On 29.04.21 15:26, Miaohe Lin wrote:
>> Rewrite the pgoff checking logic to remove macro HPAGE_CACHE_INDEX_MASK
>> which is only used here to simplify the code.
>>
>> Reviewed-by: Yang Shi <shy828301@gmail.com>
>> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>> 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;
>
> I'd have used
>
> if (!IS_ALIGNED(PHYS_PFN(vma->vm_start) - vma->vm_pgoff,
>
It's because I want keep the code style consistent with hugepage_vma_check().
There is similiar code in hugepage_vma_check():
return IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,
HPAGE_PMD_NR);
> Reviewed-by: David Hildenbrand <david@redhat.com>
Many thanks for review!
>
next prev parent reply other threads:[~2021-04-30 1:39 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 13:26 [PATCH v2 0/5] Cleanup and fixup for huge_memory Miaohe Lin
2021-04-29 13:26 ` [PATCH v2 1/5] mm/huge_memory.c: remove dedicated macro HPAGE_CACHE_INDEX_MASK Miaohe Lin
2021-04-29 14:48 ` David Hildenbrand
2021-04-30 1:39 ` Miaohe Lin [this message]
2021-04-29 13:26 ` [PATCH v2 2/5] mm/huge_memory.c: use page->deferred_list Miaohe Lin
2021-04-29 14:52 ` David Hildenbrand
2021-04-29 13:26 ` [PATCH v2 3/5] mm/huge_memory.c: add missing read-only THP checking in transparent_hugepage_enabled() Miaohe Lin
2021-04-29 14:57 ` David Hildenbrand
2021-04-29 16:23 ` Yang Shi
2021-04-30 1:57 ` Miaohe Lin
2021-04-30 7:49 ` David Hildenbrand
2021-04-30 8:20 ` Miaohe Lin
2021-04-29 13:26 ` [PATCH v2 4/5] mm/huge_memory.c: remove unnecessary tlb_remove_page_size() for huge zero pmd Miaohe Lin
2021-04-29 15:02 ` David Hildenbrand
2021-04-29 17:55 ` Yang Shi
2021-04-29 13:26 ` [PATCH v2 5/5] mm/huge_memory.c: don't discard hugepage if other processes are mapping it Miaohe Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cb8c3df7-92e1-bce6-9268-12fc10797e23@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=rcampbell@nvidia.com \
--cc=riel@surriel.com \
--cc=songliubraving@fb.com \
--cc=william.kucharski@oracle.com \
--cc=willy@infradead.org \
--cc=yang.shi@linux.alibaba.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox