linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Tatashin <pasha.tatashin@oracle.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: steven.sistare@oracle.com, daniel.m.jordan@oracle.com,
	akpm@linux-foundation.org, mgorman@techsingularity.net,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/1] mm: buddy page accessed before initialized
Date: Thu, 2 Nov 2017 12:10:39 -0400	[thread overview]
Message-ID: <8b3bb799-818b-b6b6-7c6b-9eee709decb7@oracle.com> (raw)
In-Reply-To: <20171102142742.gpkif3hgnd62nyol@dhcp22.suse.cz>

>>
>> Yes, but as I said, unfortunately memset(1) with CONFIG_VM_DEBUG does not
>> catch this case. So, when CONFIG_VM_DEBUG is enabled kexec reboots without
>> issues.
> 
> Can we make the init pattern to catch this?

Unfortunately, that is not easy: memset() gives us only one byte to play 
with, and if we use something else that will make CONFIG_VM_DEBUG 
unacceptably slow.

One byte is not enough to trigger the pattern that satisfy 
page_is_buddy() logic. I have tried it. With kexec, however it is more 
predictable: we use the same memory during boot to allocate vmemmap, and 
therefore the struct pages are more like "valid" struct pages from the 
previous boot.

> 
>>>>>> This is why we must initialize the computed buddy page beforehand.
>>>>>
>>>>> Ble, this is really ugly. I will think about it more.
>>>>>
>>>>
>>>> Another approach that I considered is to split loop inside
>>>> deferred_init_range() into two loops: one where we initialize pages by
>>>> calling __init_single_page(), another where we free them to buddy allocator
>>>> by calling deferred_free_range().
>>>
>>> Yes, that would make much more sense to me.
>>>
>>
>> Ok, so should I submit a new patch with two loops? (The logic within loops
>> is going to be the same:
> 
> Could you post it please?
>   
>> if (!pfn_valid_within(pfn)) {
>> } else if (!(pfn & nr_pgmask) && !pfn_valid(pfn)) {
>> } else if (!meminit_pfn_in_nid(pfn, nid, &nid_init_state)) {
>> } else if (page && (pfn & nr_pgmask)) {
>>
>> This fix was already added into mm-tree as
>> mm-deferred_init_memmap-improvements-fix-2.patch
> 
> I think Andrew can drop it and replace by a different patch.
> 

The new patch is coming, I will test it on two machines where I observed 
the problem.

Thank you,
Pasha

  reply	other threads:[~2017-11-02 16:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 15:50 [PATCH v1 0/1] buddy page accessed before initialized Pavel Tatashin
2017-10-31 15:50 ` [PATCH v1 1/1] mm: " Pavel Tatashin
2017-11-02 13:32   ` Michal Hocko
2017-11-02 13:39     ` Pavel Tatashin
2017-11-02 13:54       ` Michal Hocko
2017-11-02 14:00         ` Pavel Tatashin
2017-11-02 14:08           ` Michal Hocko
2017-11-02 14:16             ` Pavel Tatashin
2017-11-02 14:27               ` Michal Hocko
2017-11-02 16:10                 ` Pavel Tatashin [this message]
2017-11-03  8:59                   ` Michal Hocko
2017-11-03 14:17                     ` Pavel Tatashin

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=8b3bb799-818b-b6b6-7c6b-9eee709decb7@oracle.com \
    --to=pasha.tatashin@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.m.jordan@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=steven.sistare@oracle.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;
as well as URLs for NNTP newsgroup(s).