linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Michal Hocko <mhocko@suse.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>, Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [RFC PATCH] mm, page_alloc: avoid page_to_pfn() in move_freepages()
Date: Wed, 27 Nov 2019 10:09:30 -0500	[thread overview]
Message-ID: <0F069AED-ACAB-45D0-BAE0-329EF4418EBD@lca.pw> (raw)
In-Reply-To: <b430c512-eb70-6b8e-4f4e-98617e87ee58@huawei.com>



> On Nov 27, 2019, at 9:39 AM, Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> 
> 
> 
> On 2019/11/27 22:13, Michal Hocko wrote:
>> On Wed 27-11-19 21:13:00, Kefeng Wang wrote:
>>> 
>>> 
>>> On 2019/11/27 19:47, Michal Hocko wrote:
>>>> On Wed 27-11-19 18:28:00, Kefeng Wang wrote:
>>>>> The start_pfn and end_pfn are already available in move_freepages_block(),
>>>>> pfn_valid_within() should validate pfn first before touching the page,
>>>>> or we might access an unitialized page with CONFIG_HOLES_IN_ZONE configs.
>>>>> 
>>>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>>>> Cc: Michal Hocko <mhocko@suse.com>
>>>>> Cc: Vlastimil Babka <vbabka@suse.cz>
>>>>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>>>>> ---
>>>>> 
>>>>> Here is an oops in 4.4(arm64 enabled CONFIG_HOLES_IN_ZONE),
>>>> 
>>>> Is this reproducible with the current upstream kernel? There were large
>>>> changes in this aread since 4.4
>>> 
>>> Our inner tester found this oops twice, but couldn't be reproduced for now,
>>> even in 4.4 kernel, still trying...
>>> 
>>> But the page_to_pfn() shouldn't be used in move_freepages(), right? ; )
>> 
>> Well, I do agree that going back and forth between page and pfn is ugly.
>> So this as a cleanup makes sense to me. But you are trying to fix a bug
>> and that bug should be explained. NULL ptr dereference sounds like a
>> memmap is not allocated for the particular pfn and this is a bit
>> unexpected even with holes, at least on x86, maybe arm64 allows that.
>> But the changelog should be clear about all this rather than paper over
>> a deeper problem potentially. Please also make sure to involve arm64
>> people.
> 
> I'm still trying to reproduce it on 4.4 and 5.4, add Catalin, Will Mark,
> could you give some advice on it, thanks.
> 
> https://lore.kernel.org/linux-mm/54064878-ea85-247a-3382-b96ddf97c667@huawei.com/T/#m87c545730a0a00c45e042937593c59f6552d1246
> 
> note:
> We backport numa patches into 4.4, so the CONFIG_HOLES_IN_ZONE is enabled.
> 
> # CONFIG_NUMA is not set
> CONFIG_HOLES_IN_ZONE=y
> 
> CONFIG_SPARSEMEM_MANUAL=y
> CONFIG_SPARSEMEM=y
> CONFIG_HAVE_MEMORY_PRESENT=y
> CONFIG_SPARSEMEM_EXTREME=y
> CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
> CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER=y
> # CONFIG_SPARSEMEM_VMEMMAP is not set

See the commit b13bc35193d9 (“mm/hotplug: invalid PFNs from pfn_to_online_page()”)
where it lists a lot of code churn in that space that might indicate there are many commits
missing in your kernel.



  reply	other threads:[~2019-11-27 15:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 10:28 [RFC PATCH] mm, page_alloc: avoid page_to_pfn() in move_freepages() Kefeng Wang
2019-11-27 10:47 ` David Hildenbrand
2019-11-27 11:18   ` [PATCH] " Kefeng Wang
2019-11-27 17:06     ` David Hildenbrand
2019-11-27 11:21   ` [RFC PATCH] " Kefeng Wang
2019-11-27 11:47 ` Michal Hocko
2019-11-27 13:13   ` Kefeng Wang
2019-11-27 14:13     ` Michal Hocko
2019-11-27 14:28       ` Qian Cai
2019-11-27 14:39       ` Kefeng Wang
2019-11-27 15:09         ` Qian Cai [this message]
2019-11-27 17:15       ` David Hildenbrand

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=0F069AED-ACAB-45D0-BAE0-329EF4418EBD@lca.pw \
    --to=cai@lca.pw \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=mhocko@suse.com \
    --cc=vbabka@suse.cz \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).