Re: [PATCH] mm/hugetlb: avoid unnecessary check on pud and pmd entry in huge_pte_offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020-04-23 at 20:49 Li Xinhai wrote:
>When huge_pte_offset() is called, the parameter sz can only be PUD_SIZE
>or PMD_SIZE.
>If sz is PUD_SIZE and code can reach pud, then *pud must be none, or
>normal hugetlb entry, or non-present (migration or hwpoisoned) hugetlb
>entry, and we can directly return pud.
>When sz is PMD_SIZE, pud must be none or present, and if code can reach
>pmd, we can directly return pmd.
>
>So, after this patch, the code is simplified by first check on the
>parameter sz, and avoid unnecessary checks in current code.
>
>Signed-off-by: Li Xinhai <lixinhai.lxh@xxxxxxxxx>
>Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
>Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> 

Since this huge_pte_offset() is under CONFIG_ARCH_WANT_GENERAL_HUGETLB, 
I only have chance to test with x86_64, but the logical should hold for all other
cases which using this general implementation.

The exsiting code path was introduced by commit 9b19df292c6 (mm/hugetlb.c:
make huge_pte_offset() consistent and document behaviour), and the sematics
is maintained after current patch applied.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux