linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Qian Cai <cai@lca.pw>, David Hildenbrand <david@redhat.com>,
	Toshiki Fukasawa <t-fukasawa@vx.jp.nec.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"mhocko@kernel.org" <mhocko@kernel.org>,
	"adobriyan@gmail.com" <adobriyan@gmail.com>,
	"hch@lst.de" <hch@lst.de>,
	"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
	"mst@redhat.com" <mst@redhat.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Junichi Nomura <j-nomura@ce.jp.nec.com>
Subject: Re: [RFC PATCH v2] mm: initialize struct pages reserved by ZONE_DEVICE driver.
Date: Tue, 17 Sep 2019 13:04:28 -0400	[thread overview]
Message-ID: <bd6ea535-b228-8de0-1454-e512ccbfb4fa@redhat.com> (raw)
In-Reply-To: <1568737304.5576.162.camel@lca.pw>

On 9/17/19 12:21 PM, Qian Cai wrote:
> On Tue, 2019-09-17 at 11:49 -0400, Waiman Long wrote:
>> On 9/17/19 3:13 AM, David Hildenbrand wrote:
>>> On 17.09.19 04:34, Toshiki Fukasawa wrote:
>>>> On 2019/09/09 16:46, David Hildenbrand wrote:
>>>>> Let's take a step back here to understand the issues I am aware of. I
>>>>> think we should solve this for good now:
>>>>>
>>>>> A PFN walker takes a look at a random PFN at a random point in time. It
>>>>> finds a PFN with SECTION_MARKED_PRESENT && !SECTION_IS_ONLINE. The
>>>>> options are:
>>>>>
>>>>> 1. It is buddy memory (add_memory()) that has not been online yet. The
>>>>> memmap contains garbage. Don't access.
>>>>>
>>>>> 2. It is ZONE_DEVICE memory with a valid memmap. Access it.
>>>>>
>>>>> 3. It is ZONE_DEVICE memory with an invalid memmap, because the section
>>>>> is only partially present: E.g., device starts at offset 64MB within a
>>>>> section or the device ends at offset 64MB within a section. Don't access it.
>>>> I don't agree with case #3. In the case, struct page area is not allocated on
>>>> ZONE_DEVICE, but is allocated on system memory. So I think we can access the
>>>> struct pages. What do you mean "invalid memmap"?
>>> No, that's not the case. There is no memory, especially not system
>>> memory. We only allow partially present sections (sub-section memory
>>> hotplug) for ZONE_DEVICE.
>>>
>>> invalid memmap == memmap was not initialized == struct pages contains
>>> garbage. There is a memmap, but accessing it (e.g., pfn_to_nid()) will
>>> trigger a BUG.
>>>
>> As long as the page structures exist, they should be initialized to some
>> known state. We could set PagePoison for those invalid memmap. It is the
> Sounds like you want to run page_init_poison() by default.

Yes for those pages that are not initialized otherwise. I don't want to
run page_init_poison() for the whole ZONE_DEVICE memory range as it can
take a while if we are talking about TBs of persistent memory. Also most
of the pages will be reinitialized anyway in the init process. So it is
mostly a wasted effort. However, for those reserved pages that are not
being exported to the memory management layer, having them initialized
to a known state will cause less problem down the road.

Cheers,
Longman



  reply	other threads:[~2019-09-17 17:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06  8:09 Toshiki Fukasawa
2019-09-06  8:45 ` David Hildenbrand
2019-09-06 10:02   ` Toshiki Fukasawa
2019-09-06 10:35     ` David Hildenbrand
2019-09-09  5:48       ` Toshiki Fukasawa
2019-09-09  7:46         ` David Hildenbrand
2019-09-09  8:10           ` David Hildenbrand
2019-09-09 11:53             ` Dan Williams
2019-09-09 12:05               ` David Hildenbrand
2019-09-10  9:21                 ` Dan Williams
2019-09-10 10:10                   ` David Hildenbrand
2019-09-17  2:34           ` Toshiki Fukasawa
2019-09-17  7:13             ` David Hildenbrand
2019-09-17  9:32               ` Toshiki Fukasawa
2019-09-17 10:20                 ` David Hildenbrand
2019-09-18  2:16                   ` Toshiki Fukasawa
2019-09-17 15:49               ` Waiman Long
2019-09-17 16:21                 ` Qian Cai
2019-09-17 17:04                   ` Waiman Long [this message]
2019-09-17 20:23                     ` David Hildenbrand
2019-09-18  2:28                     ` Toshiki Fukasawa
2019-09-18  7:30           ` David Hildenbrand
2019-09-10 14:01 ` Michal Hocko
2019-09-10 14:53   ` Dan Williams
2019-09-10 17:35     ` Michal Hocko

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=bd6ea535-b228-8de0-1454-e512ccbfb4fa@redhat.com \
    --to=longman@redhat.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=hch@lst.de \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mst@redhat.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=sfr@canb.auug.org.au \
    --cc=t-fukasawa@vx.jp.nec.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