* [PATCH 0/2] mm: Minor cleanup
@ 2019-08-27 5:36 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 5:36 ` [PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section Alastair D'Silva
0 siblings, 2 replies; 12+ messages in thread
From: Alastair D'Silva @ 2019-08-27 5:36 UTC (permalink / raw)
To: alastair
Cc: Andrew Morton, Oscar Salvador, Michal Hocko, Mike Rapoport,
Dan Williams, Wei Yang, David Hildenbrand, linux-mm,
linux-kernel
From: Alastair D'Silva <alastair@d-silva.org>
This series addresses some minor issues & obsoletes:
mm: Cleanup & allow modules to hotplug memory
Alastair D'Silva (2):
mm: Don't manually decrement num_poisoned_pages
mm: don't hide potentially null memmap pointer in
sparse_remove_section
mm/sparse.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
--
2.21.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/2] mm: Don't manually decrement num_poisoned_pages
2019-08-27 5:36 [PATCH 0/2] mm: Minor cleanup Alastair D'Silva
@ 2019-08-27 5:36 ` Alastair D'Silva
2019-08-27 6:25 ` Michal Hocko
` (4 more replies)
2019-08-27 5:36 ` [PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section Alastair D'Silva
1 sibling, 5 replies; 12+ messages in thread
From: Alastair D'Silva @ 2019-08-27 5:36 UTC (permalink / raw)
To: alastair
Cc: Andrew Morton, Oscar Salvador, Michal Hocko, Dan Williams,
Mike Rapoport, David Hildenbrand, Wei Yang, Qian Cai, linux-mm,
linux-kernel
From: Alastair D'Silva <alastair@d-silva.org>
Use the function written to do it instead.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
mm/sparse.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/sparse.c b/mm/sparse.c
index 72f010d9bff5..e41917a7e844 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -11,6 +11,8 @@
#include <linux/export.h>
#include <linux/spinlock.h>
#include <linux/vmalloc.h>
+#include <linux/swap.h>
+#include <linux/swapops.h>
#include "internal.h"
#include <asm/dma.h>
@@ -898,7 +900,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
for (i = 0; i < nr_pages; i++) {
if (PageHWPoison(&memmap[i])) {
- atomic_long_sub(1, &num_poisoned_pages);
+ num_poisoned_pages_dec();
ClearPageHWPoison(&memmap[i]);
}
}
--
2.21.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section
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 5:36 ` Alastair D'Silva
2019-08-27 6:24 ` Michal Hocko
1 sibling, 1 reply; 12+ messages in thread
From: Alastair D'Silva @ 2019-08-27 5:36 UTC (permalink / raw)
To: alastair
Cc: Andrew Morton, Oscar Salvador, Michal Hocko, Mike Rapoport,
Dan Williams, Wei Yang, David Hildenbrand, Qian Cai, linux-mm,
linux-kernel
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.
This patch passes the offset to clear_hwpoisoned_pages instead, allowing
memmap to successfully perform it's null check.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
mm/sparse.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mm/sparse.c b/mm/sparse.c
index e41917a7e844..3ff84e627e58 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -882,7 +882,7 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn,
}
#ifdef CONFIG_MEMORY_FAILURE
-static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
+static void clear_hwpoisoned_pages(struct page *memmap, int start, int count)
{
int i;
@@ -898,7 +898,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
if (atomic_long_read(&num_poisoned_pages) == 0)
return;
- for (i = 0; i < nr_pages; i++) {
+ for (i = start; i < start + count; i++) {
if (PageHWPoison(&memmap[i])) {
num_poisoned_pages_dec();
ClearPageHWPoison(&memmap[i]);
@@ -906,7 +906,8 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
}
}
#else
-static inline void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
+static inline void clear_hwpoisoned_pages(struct page *memmap, int start,
+ int count)
{
}
#endif
@@ -915,7 +916,7 @@ void sparse_remove_section(struct mem_section *ms, unsigned long pfn,
unsigned long nr_pages, unsigned long map_offset,
struct vmem_altmap *altmap)
{
- clear_hwpoisoned_pages(pfn_to_page(pfn) + map_offset,
+ clear_hwpoisoned_pages(pfn_to_page(pfn), map_offset,
nr_pages - map_offset);
section_deactivate(pfn, nr_pages, altmap);
}
--
2.21.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section
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
0 siblings, 1 reply; 12+ messages in thread
From: Michal Hocko @ 2019-08-27 6:24 UTC (permalink / raw)
To: Alastair D'Silva
Cc: alastair, Andrew Morton, Oscar Salvador, Mike Rapoport,
Dan Williams, Wei Yang, David Hildenbrand, Qian Cai, linux-mm,
linux-kernel
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.
> This patch passes the offset to clear_hwpoisoned_pages instead, allowing
> memmap to successfully perform it's null check.
I do not see any improvement in this patch. It just adds a new argument
unnecessarily.
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> ---
> mm/sparse.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index e41917a7e844..3ff84e627e58 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -882,7 +882,7 @@ int __meminit sparse_add_section(int nid, unsigned long start_pfn,
> }
>
> #ifdef CONFIG_MEMORY_FAILURE
> -static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
> +static void clear_hwpoisoned_pages(struct page *memmap, int start, int count)
> {
> int i;
>
> @@ -898,7 +898,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
> if (atomic_long_read(&num_poisoned_pages) == 0)
> return;
>
> - for (i = 0; i < nr_pages; i++) {
> + for (i = start; i < start + count; i++) {
> if (PageHWPoison(&memmap[i])) {
> num_poisoned_pages_dec();
> ClearPageHWPoison(&memmap[i]);
> @@ -906,7 +906,8 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
> }
> }
> #else
> -static inline void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
> +static inline void clear_hwpoisoned_pages(struct page *memmap, int start,
> + int count)
> {
> }
> #endif
> @@ -915,7 +916,7 @@ void sparse_remove_section(struct mem_section *ms, unsigned long pfn,
> unsigned long nr_pages, unsigned long map_offset,
> struct vmem_altmap *altmap)
> {
> - clear_hwpoisoned_pages(pfn_to_page(pfn) + map_offset,
> + clear_hwpoisoned_pages(pfn_to_page(pfn), map_offset,
> nr_pages - map_offset);
> section_deactivate(pfn, nr_pages, altmap);
> }
> --
> 2.21.0
>
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] mm: Don't manually decrement num_poisoned_pages
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
` (3 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: Michal Hocko @ 2019-08-27 6:25 UTC (permalink / raw)
To: Alastair D'Silva
Cc: alastair, Andrew Morton, Oscar Salvador, Dan Williams,
Mike Rapoport, David Hildenbrand, Wei Yang, Qian Cai, linux-mm,
linux-kernel
On Tue 27-08-19 15:36:54, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> Use the function written to do it instead.
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> mm/sparse.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 72f010d9bff5..e41917a7e844 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -11,6 +11,8 @@
> #include <linux/export.h>
> #include <linux/spinlock.h>
> #include <linux/vmalloc.h>
> +#include <linux/swap.h>
> +#include <linux/swapops.h>
>
> #include "internal.h"
> #include <asm/dma.h>
> @@ -898,7 +900,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
>
> for (i = 0; i < nr_pages; i++) {
> if (PageHWPoison(&memmap[i])) {
> - atomic_long_sub(1, &num_poisoned_pages);
> + num_poisoned_pages_dec();
> ClearPageHWPoison(&memmap[i]);
> }
> }
> --
> 2.21.0
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section
2019-08-27 6:24 ` Michal Hocko
@ 2019-08-27 7:00 ` Alastair D'Silva
2019-08-27 7:08 ` David Hildenbrand
2019-08-27 7:22 ` Michal Hocko
0 siblings, 2 replies; 12+ messages in thread
From: Alastair D'Silva @ 2019-08-27 7:00 UTC (permalink / raw)
To: Michal Hocko
Cc: Andrew Morton, Oscar Salvador, Mike Rapoport, Dan Williams,
Wei Yang, David Hildenbrand, Qian Cai, linux-mm, linux-kernel
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.
--
Alastair D'Silva mob: 0423 762 819
skype: alastair_dsilva
Twitter: @EvilDeece
blog: http://alastair.d-silva.org
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] mm: Don't manually decrement num_poisoned_pages
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
` (2 subsequent siblings)
4 siblings, 0 replies; 12+ messages in thread
From: David Hildenbrand @ 2019-08-27 7:07 UTC (permalink / raw)
To: Alastair D'Silva, alastair
Cc: Andrew Morton, Oscar Salvador, Michal Hocko, Dan Williams,
Mike Rapoport, Wei Yang, Qian Cai, linux-mm, linux-kernel
On 27.08.19 07:36, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> Use the function written to do it instead.
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> ---
> mm/sparse.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 72f010d9bff5..e41917a7e844 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -11,6 +11,8 @@
> #include <linux/export.h>
> #include <linux/spinlock.h>
> #include <linux/vmalloc.h>
> +#include <linux/swap.h>
> +#include <linux/swapops.h>
>
> #include "internal.h"
> #include <asm/dma.h>
> @@ -898,7 +900,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
>
> for (i = 0; i < nr_pages; i++) {
> if (PageHWPoison(&memmap[i])) {
> - atomic_long_sub(1, &num_poisoned_pages);
> + num_poisoned_pages_dec();
> ClearPageHWPoison(&memmap[i]);
> }
> }
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section
2019-08-27 7:00 ` Alastair D'Silva
@ 2019-08-27 7:08 ` David Hildenbrand
2019-08-27 7:22 ` Michal Hocko
1 sibling, 0 replies; 12+ messages in thread
From: David Hildenbrand @ 2019-08-27 7:08 UTC (permalink / raw)
To: Alastair D'Silva, Michal Hocko
Cc: Andrew Morton, Oscar Salvador, Mike Rapoport, Dan Williams,
Wei Yang, Qian Cai, linux-mm, linux-kernel
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] mm: don't hide potentially null memmap pointer in sparse_remove_section
2019-08-27 7:00 ` Alastair D'Silva
2019-08-27 7:08 ` David Hildenbrand
@ 2019-08-27 7:22 ` Michal Hocko
1 sibling, 0 replies; 12+ messages in thread
From: Michal Hocko @ 2019-08-27 7:22 UTC (permalink / raw)
To: Alastair D'Silva
Cc: Andrew Morton, Oscar Salvador, Mike Rapoport, Dan Williams,
Wei Yang, David Hildenbrand, Qian Cai, linux-mm, linux-kernel
On Tue 27-08-19 17:00:16, Alastair D'Silva wrote:
[...]
> 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.
This would be much more preferable to the original patch.
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] mm: Don't manually decrement num_poisoned_pages
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
4 siblings, 0 replies; 12+ messages in thread
From: Mike Rapoport @ 2019-08-27 7:31 UTC (permalink / raw)
To: Alastair D'Silva
Cc: alastair, Andrew Morton, Oscar Salvador, Michal Hocko,
Dan Williams, David Hildenbrand, Wei Yang, Qian Cai, linux-mm,
linux-kernel
On Tue, Aug 27, 2019 at 03:36:54PM +1000, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> Use the function written to do it instead.
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> mm/sparse.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 72f010d9bff5..e41917a7e844 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -11,6 +11,8 @@
> #include <linux/export.h>
> #include <linux/spinlock.h>
> #include <linux/vmalloc.h>
> +#include <linux/swap.h>
> +#include <linux/swapops.h>
>
> #include "internal.h"
> #include <asm/dma.h>
> @@ -898,7 +900,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
>
> for (i = 0; i < nr_pages; i++) {
> if (PageHWPoison(&memmap[i])) {
> - atomic_long_sub(1, &num_poisoned_pages);
> + num_poisoned_pages_dec();
> ClearPageHWPoison(&memmap[i]);
> }
> }
> --
> 2.21.0
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] mm: Don't manually decrement num_poisoned_pages
2019-08-27 5:36 ` [PATCH 1/2] mm: Don't manually decrement num_poisoned_pages Alastair D'Silva
` (2 preceding siblings ...)
2019-08-27 7:31 ` Mike Rapoport
@ 2019-08-28 0:39 ` Wei Yang
2019-08-28 7:31 ` Oscar Salvador
4 siblings, 0 replies; 12+ messages in thread
From: Wei Yang @ 2019-08-28 0:39 UTC (permalink / raw)
To: Alastair D'Silva
Cc: alastair, Andrew Morton, Oscar Salvador, Michal Hocko,
Dan Williams, Mike Rapoport, David Hildenbrand, Wei Yang,
Qian Cai, linux-mm, linux-kernel
On Tue, Aug 27, 2019 at 03:36:54PM +1000, Alastair D'Silva wrote:
>From: Alastair D'Silva <alastair@d-silva.org>
>
>Use the function written to do it instead.
>
>Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
Reviewed-by: Wei Yang <richardw.yang@linux.intel.com>
>---
> mm/sparse.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/mm/sparse.c b/mm/sparse.c
>index 72f010d9bff5..e41917a7e844 100644
>--- a/mm/sparse.c
>+++ b/mm/sparse.c
>@@ -11,6 +11,8 @@
> #include <linux/export.h>
> #include <linux/spinlock.h>
> #include <linux/vmalloc.h>
>+#include <linux/swap.h>
>+#include <linux/swapops.h>
>
> #include "internal.h"
> #include <asm/dma.h>
>@@ -898,7 +900,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
>
> for (i = 0; i < nr_pages; i++) {
> if (PageHWPoison(&memmap[i])) {
>- atomic_long_sub(1, &num_poisoned_pages);
>+ num_poisoned_pages_dec();
> ClearPageHWPoison(&memmap[i]);
> }
> }
>--
>2.21.0
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] mm: Don't manually decrement num_poisoned_pages
2019-08-27 5:36 ` [PATCH 1/2] mm: Don't manually decrement num_poisoned_pages Alastair D'Silva
` (3 preceding siblings ...)
2019-08-28 0:39 ` Wei Yang
@ 2019-08-28 7:31 ` Oscar Salvador
4 siblings, 0 replies; 12+ messages in thread
From: Oscar Salvador @ 2019-08-28 7:31 UTC (permalink / raw)
To: Alastair D'Silva
Cc: alastair, Andrew Morton, Michal Hocko, Dan Williams,
Mike Rapoport, David Hildenbrand, Wei Yang, Qian Cai, linux-mm,
linux-kernel
On Tue, Aug 27, 2019 at 03:36:54PM +1000, Alastair D'Silva wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> Use the function written to do it instead.
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
> mm/sparse.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 72f010d9bff5..e41917a7e844 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -11,6 +11,8 @@
> #include <linux/export.h>
> #include <linux/spinlock.h>
> #include <linux/vmalloc.h>
> +#include <linux/swap.h>
> +#include <linux/swapops.h>
>
> #include "internal.h"
> #include <asm/dma.h>
> @@ -898,7 +900,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
>
> for (i = 0; i < nr_pages; i++) {
> if (PageHWPoison(&memmap[i])) {
> - atomic_long_sub(1, &num_poisoned_pages);
> + num_poisoned_pages_dec();
> ClearPageHWPoison(&memmap[i]);
> }
> }
> --
> 2.21.0
>
--
Oscar Salvador
SUSE L3
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2019-08-28 7:32 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-08-27 7:22 ` Michal Hocko
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).