linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Michal Hocko <mhocko@suse.com>, David Hildenbrand <david@redhat.com>
Cc: Muchun Song <songmuchun@bytedance.com>,
	akpm@linux-foundation.org, n-horiguchi@ah.jp.nec.com,
	ak@linux.intel.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Yang Shi <shy828301@gmail.com>
Subject: Re: [PATCH v3 1/6] mm: migrate: do not migrate HugeTLB page whose refcount is one
Date: Tue, 12 Jan 2021 12:12:09 -0800	[thread overview]
Message-ID: <70b5cf44-9f8c-2149-0920-823045be3fe1@oracle.com> (raw)
In-Reply-To: <20210112145325.GS22493@dhcp22.suse.cz>

On 1/12/21 6:53 AM, Michal Hocko wrote:
> On Tue 12-01-21 15:41:02, David Hildenbrand wrote:
>> On 12.01.21 15:23, Michal Hocko wrote:
>>> On Tue 12-01-21 13:16:45, Michal Hocko wrote:
>>> [...]
>>>> Well, currently pool pages are not migrateable but you are right that
>>>> this is likely something that we will need to look into in the future
>>>> and this optimization would stand in the way.
>>>
>>> After some more thinking I believe I was wrong in my last statement.
>>> This optimization shouldn't have any effect on pages on the pool as
>>> those stay at reference count 0 and they cannot be isolated either
>>> (clear_page_huge_active before it is enqueued).
>>>
>>> That being said, the migration code would still have to learn about
>>> about this pages but that is out of scope of this discussion.
>>>
>>> Sorry about the confusion from my side.
>>>
>>
>> At this point I am fairly confused what's working at what's not :D
> 
> heh, tell me something about that. Hugetlb is a maze full of land mines.
> 
>> I think this will require more thought, on how to teach
>> alloc_contig_range() (and eventually in some cases offline_pages()?) to
>> do the right thing.
> 
> Well, offlining sort of works because it retries both migrates and
> dissolves. It can fail with the later due to reservations but that can
> be expected. We can still try harder to rellocate/rebalance per numa
> pools to keep the reservation but I strongly suspect nobody has noticed
> this to be a problem so there we are.

Due to my time zone, I get to read all the previous comments before
commenting myself. :)

To be clear, this patch is handling a very specific case where a hugetlb
page was isolated for migration and after being isolated the last reference
to the page was dropped.  Normally, dropping the last reference would send
the page to free_huge_page processing.  free_huge_page processing would
either dissolve the page to the buddy allocator or more likely place the
page on the free list of the pool.  However, since isolation also holds
a reference to the page, processing is continued down the migration path.

Today there is no code to migrate free huge pages in the pool.  Only
active in use pages are migrated.  Without this patch, 'free pages' in
the very specific state above would be migrated.  But to be clear, that
was never the intention of any hugetlb migration code.  In that respect,
I believe this patch helps the current code work as designed.

David brings up the valid point that alloc_contig_range needs to deal
with free hugetlb pool pages.  However, that is code which needs to be
written as it does not exist today.  I suspect nobody thought about free
hugetlb pages when alloc_contig_range was written.  This patch should
in no way hinder development of that code.  Free huge pages have a ref
count of 0, and this code is checking for ref count of 1.

That is a long way of saying that I still agree with this patch.  The
only modification/suggestion would be enhancing the commit message as
suggested by Michal.
-- 
Mike Kravetz


  reply	other threads:[~2021-01-12 20:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-10 12:40 [PATCH v3 0/6] Fix some bugs about HugeTLB code Muchun Song
2021-01-10 12:40 ` [PATCH v3 1/6] mm: migrate: do not migrate HugeTLB page whose refcount is one Muchun Song
2021-01-12  9:42   ` Michal Hocko
2021-01-12  9:43     ` [External] " Muchun Song
2021-01-12 11:00   ` David Hildenbrand
2021-01-12 11:11     ` David Hildenbrand
2021-01-12 11:27       ` Michal Hocko
2021-01-12 11:34         ` David Hildenbrand
2021-01-12 12:16           ` Michal Hocko
2021-01-12 14:23             ` Michal Hocko
2021-01-12 14:41               ` David Hildenbrand
2021-01-12 14:53                 ` Michal Hocko
2021-01-12 20:12                   ` Mike Kravetz [this message]
2021-01-12 13:40       ` [External] " Muchun Song
2021-01-12 13:51         ` David Hildenbrand
2021-01-12 14:17           ` Muchun Song
2021-01-12 14:28             ` David Hildenbrand
2021-01-12 14:59               ` Muchun Song
2021-01-10 12:40 ` [PATCH v3 2/6] mm: hugetlbfs: fix cannot migrate the fallocated HugeTLB page Muchun Song
2021-01-11 23:04   ` Mike Kravetz
2021-01-12  9:45   ` Michal Hocko
2021-01-10 12:40 ` [PATCH v3 3/6] mm: hugetlb: fix a race between freeing and dissolving the page Muchun Song
2021-01-12  1:06   ` Mike Kravetz
2021-01-12 10:02   ` Michal Hocko
2021-01-12 10:13     ` [External] " Muchun Song
2021-01-12 11:17       ` Michal Hocko
2021-01-12 11:43         ` Muchun Song
2021-01-12 12:37           ` Michal Hocko
2021-01-12 15:05             ` Muchun Song
2021-01-10 12:40 ` [PATCH v3 4/6] mm: hugetlb: add return -EAGAIN for dissolve_free_huge_page Muchun Song
2021-01-12  1:20   ` Mike Kravetz
2021-01-12  8:33     ` Michal Hocko
2021-01-12  9:51       ` [External] " Muchun Song
2021-01-12 10:06         ` Michal Hocko
2021-01-12 10:49           ` Muchun Song
2021-01-12 11:11             ` Michal Hocko
2021-01-12 11:34               ` Muchun Song
2021-01-10 12:40 ` [PATCH v3 5/6] mm: hugetlb: fix a race between isolating and freeing page Muchun Song
2021-01-10 12:40 ` [PATCH v3 6/6] mm: hugetlb: remove VM_BUG_ON_PAGE from page_huge_active Muchun Song

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=70b5cf44-9f8c-2149-0920-823045be3fe1@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=shy828301@gmail.com \
    --cc=songmuchun@bytedance.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox