linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Muchun Song <songmuchun@bytedance.com>,
	akpm@linux-foundation.org, osalvador@suse.de,
	mike.kravetz@oracle.com, mhocko@suse.com, david@redhat.com,
	willy@infradead.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	duanxiongchun@bytedance.com, zhengqi.arch@bytedance.com,
	fam.zheng@bytedance.com, Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v2] mm: migrate: fix missing update page_private to hugetlb_page_subpool
Date: Fri, 21 May 2021 12:56:06 +0530	[thread overview]
Message-ID: <c528e29d-c395-1651-4943-27642b9e5168@arm.com> (raw)
In-Reply-To: <20210521022747.35736-1-songmuchun@bytedance.com>



On 5/21/21 7:57 AM, Muchun Song wrote:
> Since commit d6995da31122 ("hugetlb: use page.private for hugetlb specific
> page flags") converts page.private for hugetlb specific page flags. We
> should use hugetlb_page_subpool() to get the subpool pointer instead of
> page_private().
> 
> This 'could' prevent the migration of hugetlb pages. page_private(hpage)
> is now used for hugetlb page specific flags.  At migration time, the
> only flag which could be set is HPageVmemmapOptimized.  This flag will
> only be set if the new vmemmap reduction feature is enabled.  In
> addition, !page_mapping() implies an anonymous mapping.  So, this will
> prevent migration of hugetb pages in anonymous mappings if the vmemmap
> reduction feature is enabled.
> 
> In addition, that if statement checked for the rare race condition of a
> page being migrated while in the process of being freed.  Since that
> check is now wrong, we could leak hugetlb subpool usage counts.
> 
> The commit forgot to update it in the page migration routine. So fix it.
> 
> Fixes: d6995da31122 ("hugetlb: use page.private for hugetlb specific page flags")
> Reported-by: Anshuman Khandual <anshuman.khandual@arm.com>
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
> Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

Tested on all page size configs and HugeTLB migrations work as expected.

Tested-by: Anshuman Khandual <anshuman.khandual@arm.com> #arm64


      parent reply	other threads:[~2021-05-21  7:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21  2:27 Muchun Song
2021-05-21  6:32 ` Michal Hocko
2021-05-21  7:26 ` Anshuman Khandual [this message]

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=c528e29d-c395-1651-4943-27642b9e5168@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=duanxiongchun@bytedance.com \
    --cc=fam.zheng@bytedance.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.com \
    --cc=osalvador@suse.de \
    --cc=rdunlap@infradead.org \
    --cc=songmuchun@bytedance.com \
    --cc=willy@infradead.org \
    --cc=zhengqi.arch@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