Re: [PATCH v1] makedumpfile: exclude pages that are logically offline
From: David Hildenbrand
Date: Wed Nov 21 2018 - 10:35:40 EST
On 21.11.18 15:58, Kazuhito Hagio wrote:
> Hi David,
>
>> Linux marks pages that are logically offline via a page flag (map count).
>> Such pages e.g. include pages infated as part of a balloon driver or
>> pages that were not actually onlined when onlining the whole section.
>>
>> While the hypervisor usually allows to read such inflated memory, we
>> basically read and dump data that is completely irrelevant. Also, this
>> might result in quite some overhead in the hypervisor. In addition,
>> we saw some problems under Hyper-V, whereby we can crash the kernel by
>> dumping, when reading memory of a partially onlined memory segment
>> (for memory added by the Hyper-V balloon driver).
>>
>> Therefore, don't read and dump pages that are marked as being logically
>> offline.
>>
>> Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>
>> ---
>> makedumpfile.c | 34 ++++++++++++++++++++++++++++++----
>> makedumpfile.h | 1 +
>> 2 files changed, 31 insertions(+), 4 deletions(-)
>>
>> diff --git a/makedumpfile.c b/makedumpfile.c
>> index 8923538..b8bfd4c 100644
>> --- a/makedumpfile.c
>> +++ b/makedumpfile.c
>> @@ -88,6 +88,7 @@ mdf_pfn_t pfn_cache_private;
>> mdf_pfn_t pfn_user;
>> mdf_pfn_t pfn_free;
>> mdf_pfn_t pfn_hwpoison;
>> +mdf_pfn_t pfn_offline;
>>
>> mdf_pfn_t num_dumped;
>>
>> @@ -249,6 +250,21 @@ isHugetlb(unsigned long dtor)
>> && (SYMBOL(free_huge_page) == dtor));
>> }
>>
>> +static int
>> +isOffline(unsigned long flags, unsigned int _mapcount)
>> +{
>> + if (NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE) == NOT_FOUND_NUMBER)
>> + return FALSE;
>
> This is NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE), isn't it?
> If so, I will correct it when merging.
>
> Otherwise, looks good to me.
>
> Thanks!
> Kazu
Indeed,
I will most probably resend either way along with a new mm series!
Thanks a lot!
--
Thanks,
David / dhildenb