Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1742359

Re: [PATCH] mm, hugetlb: fix "treat_as_movable" condition in htlb_alloc_mask

From Mike Kravetz <mike.kravetz@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mm, hugetlb: fix "treat_as_movable" condition in htlb_alloc_mask
Date 2017-09-29 23:20 +0200
Message-ID <uvaRr-36U-19@gated-at.bofh.it> (permalink)
References <uv5f4-7SN-23@gated-at.bofh.it> <uvaop-2Gx-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Adding Anshuman

On 09/29/2017 01:43 PM, Alexandru Moise wrote:
> On Fri, Sep 29, 2017 at 05:13:39PM +0200, Alexandru Moise wrote:
>>
>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>> index 424b0ef08a60..ab28de0122af 100644
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -926,7 +926,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
>>  /* Movability of hugepages depends on migration support. */
>>  static inline gfp_t htlb_alloc_mask(struct hstate *h)
>>  {
>> -	if (hugepages_treat_as_movable || hugepage_migration_supported(h))
>> +	if (hugepages_treat_as_movable && hugepage_migration_supported(h))
>>  		return GFP_HIGHUSER_MOVABLE;
>>  	else
>>  		return GFP_HIGHUSER;
>> -- 
>> 2.14.2
>>
> 
> I seem to have terribly misunderstood the semantics of this flag wrt hugepages,
> please ignore this for now.

That is Okay, it made me look at this code more closely.

static inline bool hugepage_migration_supported(struct hstate *h)
{
#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
        if ((huge_page_shift(h) == PMD_SHIFT) ||
                (huge_page_shift(h) == PGDIR_SHIFT))
                return true;
        else
                return false;
#else
        return false;
#endif
}

So, hugepage_migration_supported() can only return true if
ARCH_ENABLE_HUGEPAGE_MIGRATION is defined.  Commit c177c81e09e5
restricts hugepage_migration_support to x86_64.  So,
ARCH_ENABLE_HUGEPAGE_MIGRATION is only defined for x86_64.

Commit 94310cbcaa3c added the ability to migrate gigantic hugetlb pages
at the PGD level.  This added the check for PGD level pages to
hugepage_migration_supported(), which is only there if
ARCH_ENABLE_HUGEPAGE_MIGRATION is defined.  IIUC, this functionality
was added for powerpc.  Yet, powerpc does not define
ARCH_ENABLE_HUGEPAGE_MIGRATION (unless I am missing something).

-- 
Mike Kravetz

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm, hugetlb: fix "treat_as_movable" condition in  htlb_alloc_mask Alexandru Moise <00moses.alexander00@gmail.com> - 2017-09-29 17:20 +0200
  Re: [PATCH] mm, hugetlb: fix "treat_as_movable" condition in  htlb_alloc_mask Alexandru Moise <00moses.alexander00@gmail.com> - 2017-09-29 22:50 +0200
    Re: [PATCH] mm, hugetlb: fix "treat_as_movable" condition in  htlb_alloc_mask Mike Kravetz <mike.kravetz@oracle.com> - 2017-09-29 23:20 +0200
      Re: [PATCH] mm, hugetlb: fix "treat_as_movable" condition in  htlb_alloc_mask Alexandru Moise <00moses.alexander00@gmail.com> - 2017-09-30 10:40 +0200

csiph-web