Re: [PATCH] mm: check pfn_valid first in zero_resv_unavail

From: Pavel Tatashin
Date: Thu Nov 30 2017 - 12:25:25 EST


Hi Dave,

Because unavailable memory can be in the middle of a section, I think
a proper fix would be to do pfn_valid() check only at the beginning of
section. Otherwise, we might miss zeroing a struct page is in the
middle of a section but pfn_valid() could potentially return false as
that page is indeed invalid.

So, I would do something like this:
+ if (!pfn_valid(ALIGN_DOWN(pfn, pageblock_nr_pages))
+ continue;

Could you please test if this fix works?

We should really look into this memory that is reserved by memblock
but Linux is not aware of physical backing, so far I know that only
x86 can have such scenarios, so we should really see if the problem
can be addressed on x86 platform. It would be very nice if we could
enforce inside memblock to reserve only memory that has real physical
backing.

Thank you,
Pavel