linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Alastair D'Silva <alastair@d-silva.org>,
	Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Oscar Salvador <osalvador@suse.de>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Wei Yang <richardw.yang@linux.intel.com>, Qian Cai <cai@lca.pw>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section
Date: Tue, 27 Aug 2019 09:08:49 +0200	[thread overview]
Message-ID: <4a08e3ec-1859-e4a7-6c08-5f36b09712d4@redhat.com> (raw)
In-Reply-To: <befab2a0a9f160f8af8c1a412068060636a7a64c.camel@d-silva.org>

On 27.08.19 09:00, Alastair D'Silva wrote:
> On Tue, 2019-08-27 at 08:24 +0200, Michal Hocko wrote:
>> On Tue 27-08-19 15:36:55, Alastair D'Silva wrote:
>>> From: Alastair D'Silva <alastair@d-silva.org>
>>>
>>> By adding offset to memmap before passing it in to
>>> clear_hwpoisoned_pages,
>>> we hide a theoretically null memmap from the null check inside
>>> clear_hwpoisoned_pages.
>>
>> Isn't that other way around? Calculating the offset struct page
>> pointer
>> will actually make the null check effective. Besides that I cannot
>> really see how pfn_to_page would return NULL. I have to confess that
>> I
>> cannot really see how offset could lead to a NULL struct page either
>> and
>> I strongly suspect that the NULL check is not really needed. Maybe it
>> used to be in the past.
>>
> 
> You're probably right, but I didn't feel confident in removing the NULL
> check. 
> 
> While the NULL check remains though, I can't see how adding the offset
> would turn a non-NULL pointer into a NULL unless the pointer is invalid
> in the first place, and if this is the case, we should have a comment
> explaining this.
> 
> The NULL check was added in commit:
> 95a4774d055c ("memory-hotplug: update mce_bad_pages when removing the
> memory")
> where memmap was originally inited to NULL, and only conditionally
> given a value.
> 
> With this in mind, since that situation is no longer true, I think we
> could instead drop the NULL check.
> 

Makes sense to me.

-- 

Thanks,

David / dhildenb


  reply	other threads:[~2019-08-27  7:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27  5:36 [PATCH 0/2] mm: Minor cleanup Alastair D'Silva
2019-08-27  5:36 ` [PATCH 1/2] mm: Don't manually decrement num_poisoned_pages Alastair D'Silva
2019-08-27  6:25   ` Michal Hocko
2019-08-27  7:07   ` David Hildenbrand
2019-08-27  7:31   ` Mike Rapoport
2019-08-28  0:39   ` Wei Yang
2019-08-28  7:31   ` Oscar Salvador
2019-08-27  5:36 ` [PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section Alastair D'Silva
2019-08-27  6:24   ` Michal Hocko
2019-08-27  7:00     ` Alastair D'Silva
2019-08-27  7:08       ` David Hildenbrand [this message]
2019-08-27  7:22       ` 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=4a08e3ec-1859-e4a7-6c08-5f36b09712d4@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=alastair@d-silva.org \
    --cc=cai@lca.pw \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    --cc=richardw.yang@linux.intel.com \
    --cc=rppt@linux.ibm.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