2019-06-26 06:13:08

by Alastair D'Silva

[permalink] [raw]
Subject: [PATCH v2 3/3] mm: Don't manually decrement num_poisoned_pages

From: Alastair D'Silva <[email protected]>

Use the function written to do it instead.

Signed-off-by: Alastair D'Silva <[email protected]>
---
mm/sparse.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 1ec32aef5590..d9b3625bfdf0 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>
@@ -772,7 +774,7 @@ static void clear_hwpoisoned_pages(struct page *memmap,

for (i = start; i < start + count; i++) {
if (PageHWPoison(&memmap[i])) {
- atomic_long_sub(1, &num_poisoned_pages);
+ num_poisoned_pages_dec();
ClearPageHWPoison(&memmap[i]);
}
}
--
2.21.0


2019-06-26 06:25:41

by Michal Hocko

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] mm: Don't manually decrement num_poisoned_pages

On Wed 26-06-19 16:11:23, Alastair D'Silva wrote:
> From: Alastair D'Silva <[email protected]>
>
> Use the function written to do it instead.

I am not sure a single line helper is a great win but this makes the
code consistent at least.

> Signed-off-by: Alastair D'Silva <[email protected]>

Acked-by: Michal Hocko <[email protected]>

> ---
> mm/sparse.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 1ec32aef5590..d9b3625bfdf0 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>
> @@ -772,7 +774,7 @@ static void clear_hwpoisoned_pages(struct page *memmap,
>
> for (i = start; i < start + count; 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

2019-06-28 11:31:36

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] mm: Don't manually decrement num_poisoned_pages

On 26.06.19 08:11, Alastair D'Silva wrote:
> From: Alastair D'Silva <[email protected]>
>
> Use the function written to do it instead.
>
> Signed-off-by: Alastair D'Silva <[email protected]>
> ---
> mm/sparse.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 1ec32aef5590..d9b3625bfdf0 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>
> @@ -772,7 +774,7 @@ static void clear_hwpoisoned_pages(struct page *memmap,
>
> for (i = start; i < start + count; i++) {
> if (PageHWPoison(&memmap[i])) {
> - atomic_long_sub(1, &num_poisoned_pages);
> + num_poisoned_pages_dec();
> ClearPageHWPoison(&memmap[i]);
> }
> }
>

Reviewed-by: David Hildenbrand <[email protected]>

--

Thanks,

David / dhildenb