linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Alastair D'Silva <alastair@d-silva.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Wei Yang <richard.weiyang@gmail.com>, Qian Cai <cai@lca.pw>,
	Alexander Duyck <alexander.h.duyck@linux.intel.com>,
	Logan Gunthorpe <logang@deltatee.com>,
	Baoquan He <bhe@redhat.com>, Balbir Singh <bsingharora@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: Remove NULL check in clear_hwpoisoned_pages()
Date: Thu, 29 Aug 2019 09:27:12 +0200	[thread overview]
Message-ID: <20190829072712.GS28313@dhcp22.suse.cz> (raw)
In-Reply-To: <20190829035151.20975-1-alastair@d-silva.org>

On Thu 29-08-19 13:51:50, Alastair D'Silva wrote:
> There is no possibility for memmap to be NULL in the current
> codebase.
> 
> This 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.
> 
> The code that could have passed a NULL has been removed, so there

removed by  ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug")
> is no longer a possibility that memmap can be NULL.

I haven't studied whether section_mem_map could have been NULL before
then but the important part is that NULL is not possible anymore as
pfn_to_page shouldn't ever return NULL.
 
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>

Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!

> ---
>  mm/sparse.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 78979c142b7d..9f7e3682cdcb 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -754,9 +754,6 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
>  {
>  	int i;
>  
> -	if (!memmap)
> -		return;
> -
>  	/*
>  	 * A further optimization is to have per section refcounted
>  	 * num_poisoned_pages.  But that would need more space per memmap, so
> -- 
> 2.21.0

-- 
Michal Hocko
SUSE Labs


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29  3:51 Alastair D'Silva
2019-08-29  7:27 ` Michal Hocko [this message]
2019-08-30 14:04 ` David Hildenbrand

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=20190829072712.GS28313@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alastair@d-silva.org \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=bhe@redhat.com \
    --cc=bsingharora@gmail.com \
    --cc=cai@lca.pw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=logang@deltatee.com \
    --cc=richard.weiyang@gmail.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