2020-06-05 09:28:08

by SeongJae Park

[permalink] [raw]
Subject: [PATCH 0/2] Trivial fixups

From: SeongJae Park <[email protected]>

This patchset fixes a potential problem in idle page tracking and adds
more typos in the scripts/spelling.txt. The problem and the typos were
found during my DAMON[1] work.

This patchset is based on next/akpm.

[1] https://lore.kernel.org/linux-mm/[email protected]/

SeongJae Park (2):
mm/page_idle.c: Skip offline pages
scripts/spelling: Add a few more typos

mm/page_idle.c | 7 ++-----
scripts/spelling.txt | 9 +++++++++
2 files changed, 11 insertions(+), 5 deletions(-)

--
2.17.1


2020-06-05 09:28:19

by SeongJae Park

[permalink] [raw]
Subject: [PATCH 1/2] mm/page_idle.c: Skip offline pages

From: SeongJae Park <[email protected]>

'Idle page tracking' users can pass random pfn that might be mapped to
an offline page. To avoid accessing such pages, this commit modifies
the 'page_idle_get_page()' to use 'pfn_to_online_page()' instead of
'pfn_valid()' and 'pfn_to_page()' combination, so that the pfn mapped to
an offline page can be skipped.

Signed-off-by: SeongJae Park <[email protected]>
Reported-by: David Hildenbrand <[email protected]>
---
mm/page_idle.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/mm/page_idle.c b/mm/page_idle.c
index 295512465065..057c61df12db 100644
--- a/mm/page_idle.c
+++ b/mm/page_idle.c
@@ -4,6 +4,7 @@
#include <linux/fs.h>
#include <linux/sysfs.h>
#include <linux/kobject.h>
+#include <linux/memory_hotplug.h>
#include <linux/mm.h>
#include <linux/mmzone.h>
#include <linux/pagemap.h>
@@ -30,13 +31,9 @@
*/
static struct page *page_idle_get_page(unsigned long pfn)
{
- struct page *page;
+ struct page *page = pfn_to_online_page(pfn);
pg_data_t *pgdat;

- if (!pfn_valid(pfn))
- return NULL;
-
- page = pfn_to_page(pfn);
if (!page || !PageLRU(page) ||
!get_page_unless_zero(page))
return NULL;
--
2.17.1

2020-06-05 09:28:52

by SeongJae Park

[permalink] [raw]
Subject: [PATCH 2/2] scripts/spelling: Add a few more typos

From: SeongJae Park <[email protected]>

This commit adds typos I found from another works.

Signed-off-by: SeongJae Park <[email protected]>
---
scripts/spelling.txt | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/scripts/spelling.txt b/scripts/spelling.txt
index d9cd24cf0d40..c45e9afaab2d 100644
--- a/scripts/spelling.txt
+++ b/scripts/spelling.txt
@@ -59,6 +59,7 @@ actualy||actually
acumulating||accumulating
acumulative||accumulative
acumulator||accumulator
+acutally||actually
adapater||adapter
addional||additional
additionaly||additionally
@@ -249,6 +250,7 @@ calescing||coalescing
calle||called
callibration||calibration
callled||called
+callser||caller
calucate||calculate
calulate||calculate
cancelation||cancellation
@@ -671,6 +673,7 @@ hanlde||handle
hanled||handled
happend||happened
harware||hardware
+havind||having
heirarchically||hierarchically
helpfull||helpful
hexdecimal||hexadecimal
@@ -845,6 +848,7 @@ logile||logfile
loobpack||loopback
loosing||losing
losted||lost
+maangement||management
machinary||machinery
maibox||mailbox
maintainance||maintenance
@@ -905,6 +909,7 @@ modfiy||modify
modulues||modules
momery||memory
memomry||memory
+monitring||monitoring
monochorome||monochrome
monochromo||monochrome
monocrome||monochrome
@@ -1010,6 +1015,7 @@ partiton||partition
pased||passed
passin||passing
pathes||paths
+pattrns||patterns
pecularities||peculiarities
peformance||performance
peforming||performing
@@ -1256,6 +1262,7 @@ shoule||should
shrinked||shrunk
siginificantly||significantly
signabl||signal
+significanly||significantly
similary||similarly
similiar||similar
simlar||similar
@@ -1371,6 +1378,7 @@ thead||thread
therfore||therefore
thier||their
threds||threads
+threee||three
threshhold||threshold
thresold||threshold
throught||through
@@ -1410,6 +1418,7 @@ tyep||type
udpate||update
uesd||used
uknown||unknown
+usccess||success
usupported||unsupported
uncommited||uncommitted
unconditionaly||unconditionally
--
2.17.1

2020-06-05 09:29:44

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH 1/2] mm/page_idle.c: Skip offline pages

On 05.06.20 11:25, SeongJae Park wrote:
> From: SeongJae Park <[email protected]>
>
> 'Idle page tracking' users can pass random pfn that might be mapped to
> an offline page. To avoid accessing such pages, this commit modifies
> the 'page_idle_get_page()' to use 'pfn_to_online_page()' instead of
> 'pfn_valid()' and 'pfn_to_page()' combination, so that the pfn mapped to
> an offline page can be skipped.
>
> Signed-off-by: SeongJae Park <[email protected]>
> Reported-by: David Hildenbrand <[email protected]>
> ---
> mm/page_idle.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/mm/page_idle.c b/mm/page_idle.c
> index 295512465065..057c61df12db 100644
> --- a/mm/page_idle.c
> +++ b/mm/page_idle.c
> @@ -4,6 +4,7 @@
> #include <linux/fs.h>
> #include <linux/sysfs.h>
> #include <linux/kobject.h>
> +#include <linux/memory_hotplug.h>
> #include <linux/mm.h>
> #include <linux/mmzone.h>
> #include <linux/pagemap.h>
> @@ -30,13 +31,9 @@
> */
> static struct page *page_idle_get_page(unsigned long pfn)
> {
> - struct page *page;
> + struct page *page = pfn_to_online_page(pfn);
> pg_data_t *pgdat;
>
> - if (!pfn_valid(pfn))
> - return NULL;
> -
> - page = pfn_to_page(pfn);
> if (!page || !PageLRU(page) ||
> !get_page_unless_zero(page))
> return NULL;
>

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

--
Thanks,

David / dhildenb

2020-06-05 09:34:03

by Pankaj Gupta

[permalink] [raw]
Subject: Re: [PATCH 1/2] mm/page_idle.c: Skip offline pages

> From: SeongJae Park <[email protected]>
>
> 'Idle page tracking' users can pass random pfn that might be mapped to
> an offline page. To avoid accessing such pages, this commit modifies
> the 'page_idle_get_page()' to use 'pfn_to_online_page()' instead of
> 'pfn_valid()' and 'pfn_to_page()' combination, so that the pfn mapped to
> an offline page can be skipped.
>
> Signed-off-by: SeongJae Park <[email protected]>
> Reported-by: David Hildenbrand <[email protected]>
> ---
> mm/page_idle.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/mm/page_idle.c b/mm/page_idle.c
> index 295512465065..057c61df12db 100644
> --- a/mm/page_idle.c
> +++ b/mm/page_idle.c
> @@ -4,6 +4,7 @@
> #include <linux/fs.h>
> #include <linux/sysfs.h>
> #include <linux/kobject.h>
> +#include <linux/memory_hotplug.h>
> #include <linux/mm.h>
> #include <linux/mmzone.h>
> #include <linux/pagemap.h>
> @@ -30,13 +31,9 @@
> */
> static struct page *page_idle_get_page(unsigned long pfn)
> {
> - struct page *page;
> + struct page *page = pfn_to_online_page(pfn);
> pg_data_t *pgdat;
>
> - if (!pfn_valid(pfn))
> - return NULL;
> -
> - page = pfn_to_page(pfn);
> if (!page || !PageLRU(page) ||
> !get_page_unless_zero(page))
> return NULL;

Reviewed-by: Pankaj Gupta <[email protected]>

2020-06-05 09:39:27

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH 2/2] scripts/spelling: Add a few more typos

On 05.06.20 11:25, SeongJae Park wrote:
> From: SeongJae Park <[email protected]>
>
> This commit adds typos I found from another works.
>
> Signed-off-by: SeongJae Park <[email protected]>
> ---
> scripts/spelling.txt | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/scripts/spelling.txt b/scripts/spelling.txt
> index d9cd24cf0d40..c45e9afaab2d 100644
> --- a/scripts/spelling.txt
> +++ b/scripts/spelling.txt
> @@ -59,6 +59,7 @@ actualy||actually
> acumulating||accumulating
> acumulative||accumulative
> acumulator||accumulator
> +acutally||actually
> adapater||adapter
> addional||additional
> additionaly||additionally
> @@ -249,6 +250,7 @@ calescing||coalescing
> calle||called
> callibration||calibration
> callled||called
> +callser||caller
> calucate||calculate
> calulate||calculate
> cancelation||cancellation
> @@ -671,6 +673,7 @@ hanlde||handle
> hanled||handled
> happend||happened
> harware||hardware
> +havind||having
> heirarchically||hierarchically
> helpfull||helpful
> hexdecimal||hexadecimal
> @@ -845,6 +848,7 @@ logile||logfile
> loobpack||loopback
> loosing||losing
> losted||lost
> +maangement||management
> machinary||machinery
> maibox||mailbox
> maintainance||maintenance
> @@ -905,6 +909,7 @@ modfiy||modify
> modulues||modules
> momery||memory
> memomry||memory
> +monitring||monitoring
> monochorome||monochrome
> monochromo||monochrome
> monocrome||monochrome
> @@ -1010,6 +1015,7 @@ partiton||partition
> pased||passed
> passin||passing
> pathes||paths
> +pattrns||patterns
> pecularities||peculiarities
> peformance||performance
> peforming||performing
> @@ -1256,6 +1262,7 @@ shoule||should
> shrinked||shrunk
> siginificantly||significantly
> signabl||signal
> +significanly||significantly
> similary||similarly
> similiar||similar
> simlar||similar
> @@ -1371,6 +1378,7 @@ thead||thread
> therfore||therefore
> thier||their
> threds||threads
> +threee||three
> threshhold||threshold
> thresold||threshold
> throught||through
> @@ -1410,6 +1418,7 @@ tyep||type
> udpate||update
> uesd||used
> uknown||unknown
> +usccess||success
> usupported||unsupported
> uncommited||uncommitted
> unconditionaly||unconditionally
>

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

--
Thanks,

David / dhildenb