All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Michal Hocko <mhocko@suse.com>
Cc: Li Xinhai <lixinhai.lxh@gmail.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	akpm <akpm@linux-foundation.org>,
	Mike Kravetz <mike.kravetz@oracle.com>
Subject: Re: [PATCH v4] mm/mempolicy,hugetlb: Checking hstate for hugetlbfs page in vma_migratable
Date: Tue, 21 Jan 2020 08:52:32 +0530	[thread overview]
Message-ID: <586fec3c-fb67-9756-1599-1d632eeb12d9@arm.com> (raw)
In-Reply-To: <20200120113200.GZ18451@dhcp22.suse.cz>



On 01/20/2020 05:02 PM, Michal Hocko wrote:
> On Mon 20-01-20 14:51:31, Anshuman Khandual wrote:
>>
>>
>> On 01/16/2020 08:48 PM, Michal Hocko wrote:
>>> On Thu 16-01-20 21:50:34, Li Xinhai wrote:
>>>> On 2020-01-16 at 17:56 Michal Hocko wrote:
>>>>> On Thu 16-01-20 04:11:25, Li Xinhai wrote:
>>>>>> Checking hstate at early phase when isolating page, instead of during
>>>>>> unmap and move phase, to avoid useless isolation.
>>>>>
>>>>> Could you be more specific what you mean by isolation and why does it
>>>>> matter? The patch description should really explain _why_ the change is
>>>>> needed or desirable. 
>>>>
>>>> The changelog can be improved:
>>>>
>>>> vma_migratable() is called to check if pages in vma can be migrated
>>>> before go ahead to isolate, unmap and move pages. For hugetlb pages,
>>>> hugepage_migration_supported(struct hstate *h) is one factor which
>>>> decide if migration is supported. In current code, this function is called
>>>> from unmap_and_move_huge_page(), after isolating page has
>>>> completed.
>>>> This patch checks hstate from vma_migratable() and avoids isolating pages
>>>> which are not supported.
>>>
>>> This still explains what but not why this is relevant. If by isolating
>>> pages you mean isolate_lru_page then this really a noop for hugetlb
>>> pages. Or do I still misread your changelog?
>>
>> unmap_and_move_hugepage() aborts migrating a HugeTLB page (from the list)
>> if it's corresponding hstate does not support migration.
> 
> But all architectures support all hugeltb sizes unless I am missing
> something. If there is some which doesn't then the changelog should
> mention that. I have already asked for runtime effects with no data
> provided.

You are right that all hugetlb sizes are supported right now whether the
platform defines arch_hugetlb_migration_supported() callback or not. But
in theory an override for the arch callback can deny migration support
for certain huge page sizes.

> 
> Just to make it clear. I am not objecting to the patch itself. I am
> objecting to the very vague justification. The changelog doesn't explain
> _why_ do we need to change this. Is it a bug, non-optimal code, pure
> code clean up for a more robust code?

AFAICS this tries to solve the problem like a sub-optimal code. But for
now as there are no real HugeTLB cases for an early bail out, there can
be an argument not to add new cost into via vma_migratable() which will
be called more often for non-HugeTLB VMAs. Probably adding a comment in
the code like this might just be sufficient.

diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 5228c62..ca9c343 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -186,6 +186,13 @@ static inline bool vma_migratable(struct vm_area_struct *vma)
                return false;
 
 #ifndef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
+       /*
+        * NOTE: hugepage_migration_supported() should have been called here
+        * for an early bail out in cases where HugeTLB page sizes are not
+        * supported for migration. But for now as there are no such real
+        * cases, hence it is better not to add any additional cost here by
+        * calling hugepage_migration_supported().
+        */
        if (vma->vm_flags & VM_HUGETLB)
                return false;
 #endif


  reply	other threads:[~2020-01-21  3:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16  4:11 [PATCH v4] mm/mempolicy,hugetlb: Checking hstate for hugetlbfs page in vma_migratable Li Xinhai
2020-01-16  9:56 ` Michal Hocko
2020-01-16 13:50   ` Li Xinhai
2020-01-16 15:18     ` Michal Hocko
2020-01-16 15:38       ` Li Xinhai
2020-01-17  3:16         ` Li Xinhai
2020-01-18  3:11           ` Li Xinhai
2020-01-18  3:11             ` Li Xinhai
2020-01-18 15:27             ` Li Xinhai
2020-01-20 10:12             ` Michal Hocko
2020-01-20 15:37               ` Li Xinhai
2020-01-20 16:05                 ` Michal Hocko
2020-01-21  3:42                   ` Anshuman Khandual
2020-01-21 13:08                     ` Li Xinhai
2020-01-21 12:44                   ` Li Xinhai
2020-01-20  9:21       ` Anshuman Khandual
2020-01-20 11:32         ` Michal Hocko
2020-01-21  3:22           ` Anshuman Khandual [this message]
2020-01-20 14:19         ` Li Xinhai
2020-01-22  6:05 ` Anshuman Khandual
2020-01-22 13:21   ` Li Xinhai
2020-01-23  7:48     ` Anshuman Khandual

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=586fec3c-fb67-9756-1599-1d632eeb12d9@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=lixinhai.lxh@gmail.com \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.