* [PATCH] mm: Remove NULL check in clear_hwpoisoned_pages()
@ 2019-08-29 3:51 Alastair D'Silva
2019-08-29 7:27 ` Michal Hocko
2019-08-30 14:04 ` David Hildenbrand
0 siblings, 2 replies; 3+ messages in thread
From: Alastair D'Silva @ 2019-08-29 3:51 UTC (permalink / raw)
To: alastair
Cc: Andrew Morton, Mike Rapoport, Michal Hocko, Wei Yang, Qian Cai,
Alexander Duyck, Logan Gunthorpe, Baoquan He, Balbir Singh,
linux-mm, linux-kernel
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
is no longer a possibility that memmap can be NULL.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: Remove NULL check in clear_hwpoisoned_pages()
2019-08-29 3:51 [PATCH] mm: Remove NULL check in clear_hwpoisoned_pages() Alastair D'Silva
@ 2019-08-29 7:27 ` Michal Hocko
2019-08-30 14:04 ` David Hildenbrand
1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2019-08-29 7:27 UTC (permalink / raw)
To: Alastair D'Silva
Cc: Andrew Morton, Mike Rapoport, Wei Yang, Qian Cai,
Alexander Duyck, Logan Gunthorpe, Baoquan He, Balbir Singh,
linux-mm, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: Remove NULL check in clear_hwpoisoned_pages()
2019-08-29 3:51 [PATCH] mm: Remove NULL check in clear_hwpoisoned_pages() Alastair D'Silva
2019-08-29 7:27 ` Michal Hocko
@ 2019-08-30 14:04 ` David Hildenbrand
1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand @ 2019-08-30 14:04 UTC (permalink / raw)
To: Alastair D'Silva
Cc: Andrew Morton, Mike Rapoport, Michal Hocko, Wei Yang, Qian Cai,
Alexander Duyck, Logan Gunthorpe, Baoquan He, Balbir Singh,
linux-mm, linux-kernel
On 29.08.19 05:51, 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
> is no longer a possibility that memmap can be NULL.
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> ---
> 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
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-30 14:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29 3:51 [PATCH] mm: Remove NULL check in clear_hwpoisoned_pages() Alastair D'Silva
2019-08-29 7:27 ` Michal Hocko
2019-08-30 14:04 ` David Hildenbrand
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).