On 06/24/2019 11:40 AM, Pingfan Liu wrote: > On Mon, Jun 24, 2019 at 1:16 PM Anshuman Khandual > <anshuman.khandual@xxxxxxx> wrote: >> >> >> >> On 06/24/2019 09:51 AM, Pingfan Liu wrote: >>> The current pfn_range_valid_gigantic() rejects the pud huge page allocation >>> if there is a pmd huge page inside the candidate range. >>> >>> But pud huge resource is more rare, which should align on 1GB on x86. It is >>> worth to allow migrating away pmd huge page to make room for a pud huge >>> page. >>> >>> The same logic is applied to pgd and pud huge pages. >> >> The huge page in the range can either be a THP or HugeTLB and migrating them has >> different costs and chances of success. THP migration will involve splitting if >> THP migration is not enabled and all related TLB related costs. Are you sure >> that a PUD HugeTLB allocation really should go through these ? Is there any > PUD hugetlb has already driven out PMD thp in current. This patch just > want to make PUD hugetlb survives PMD hugetlb. You are right. PageHuge() is true only for HugeTLB pages unlike PageTransHuge() which is true for both HugeTLB and THP pages. So the current code does migrate the THP out in order to allocate a gigantic HugeTLB. While here just wondering should not we exclude THP as well unless it supports ARCH_HAS_THP_MIGRATION.