Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752608AbdI2VRh (ORCPT ); Fri, 29 Sep 2017 17:17:37 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:34628 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752589AbdI2VRf (ORCPT ); Fri, 29 Sep 2017 17:17:35 -0400 Subject: Re: [PATCH] mm, hugetlb: fix "treat_as_movable" condition in htlb_alloc_mask To: Alexandru Moise <00moses.alexander00@gmail.com>, akpm@linux-foundation.org, Anshuman Khandual Cc: mhocko@suse.com, n-horiguchi@ah.jp.nec.com, aneesh.kumar@linux.vnet.ibm.com, punit.agrawal@arm.com, gerald.schaefer@de.ibm.com, aarcange@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kirill@shutemov.name References: <20170929151339.GA4398@gmail.com> <20170929204321.GA593@gmail.com> From: Mike Kravetz Message-ID: Date: Fri, 29 Sep 2017 14:16:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170929204321.GA593@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1862 Lines: 54 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