mm: small cleanups for io-mapping, debug_page_alloc and numa
Subsystems (3)
cover mm: small cleanups for io-mapping, debug_page_alloc and numa
From: Ye Liu <[email protected]>
This series includes three small cleanups to mm/:
- io-mapping: simplify remap protection flag calculation
- debug_page_alloc: improve error message by printing invalid input
- numa: remove unnecessary variable for clarity
No functional changes.
Ye Liu (3):
mm/io-mapping: precompute remap protection flags for clarity mm/debug_page_alloc: improve error message for invalid guardpage
minorder
mm/numa: remove unnecessary local variable in alloc_node_data()
mm/debug_page_alloc.c | 2 +- mm/io-mapping.c | 7 ++++--- mm/numa.c | 4 +--- 3 files changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/3 mm/io-mapping: precompute remap protection flags for clarity
From: Ye Liu <[email protected]>
In io_mapping_map_user(), precompute the page protection flags in a local variable before calling remap_pfn_range_notrack().
No functional change.
--- mm/io-mapping.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
mm/io-mapping.c +4 -3
@@ -21,9 +21,10 @@ int io_mapping_map_user(struct io_mapping *iomap, struct vm_area_struct *vma,if (WARN_ON_ONCE ((vma->vm_flags & expected_flags) != expected_flags))return -EINVAL ; +pgprot_t remap_prot =__pgprot ((pgprot_val (iomap->prot) & _PAGE_CACHE_MASK) | + (pgprot_val (vma->vm_page_prot) & ~_PAGE_CACHE_MASK)); +/* We rely on prevalidation of the io-mapping to skip track_pfn(). */ -return remap_pfn_range_notrack (vma, addr, pfn, size, -__pgprot ((pgprot_val (iomap->prot) & _PAGE_CACHE_MASK) | - (pgprot_val (vma->vm_page_prot) & ~_PAGE_CACHE_MASK))); +return remap_pfn_range_notrack (vma, addr, pfn, size, remap_prot); }EXPORT_SYMBOL_GPL (io_mapping_map_user);
Signature · 1 line
2.25.1
PATCH 2/3 mm/debug_page_alloc: improve error message for invalid guardpage minorder
In reply to Ye LiuFrom: Ye Liu <[email protected]>
When an invalid debug_guardpage_minorder value is provided, include the user input in the error message. This helps users and developers diagnose configuration issues more easily.
No functional change.
--- mm/debug_page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/debug_page_alloc.c +1 -1
@@ -23,7 +23,7 @@ static int __init debug_guardpage_minorder_setup(char *buf)unsigned long res;if (kstrtoul (buf,10 , &res) <0 || res >MAX_PAGE_ORDER /2 ) { -pr_err ("Bad debug_guardpage_minorder value\n" ); +pr_err ("Bad debug_guardpage_minorder value: %s\n" , buf);return 0 ; } _debug_guardpage_minorder = res;
Signature · 1 line
2.25.1
PATCH 3/3 mm/numa: remove unnecessary local variable in alloc_node_data()
In reply to Ye LiuFrom: Ye Liu <[email protected]>
The temporary local variable 'nd' is redundant. Directly assign the virtual address to node_data[nid] to simplify the code.
No functional change.
--- mm/numa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
mm/numa.c +1 -3
@@ -13,7 +13,6 @@ void __init alloc_node_data(int nid) {const size_t nd_size =roundup (sizeof (pg_data_t),SMP_CACHE_BYTES );u64 nd_pa; -void *nd;int tnid;/* Allocate node data. Try node-local memory and then any node. */
@@ -21,7 +20,6 @@ void __init alloc_node_data(int nid)if (!nd_pa)panic ("Cannot allocate %zu bytes for node %d data\n" , nd_size, nid); - nd =__va (nd_pa);/* report and initialize */ pr_info("NODE_DATA(%d) allocated [mem %#010Lx-%#010Lx]\n", nid,
@@ -30,7 +28,7 @@ void __init alloc_node_data(int nid)if (tnid != nid)pr_info (" NODE_DATA(%d) on node %d\n" , nid, tnid); - node_data[nid] = nd; + node_data[nid] =__va (nd_pa);memset (NODE_DATA (nid),0 ,sizeof (pg_data_t)); }
Signature · 1 line
2.25.1
Re: [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity
In reply to Ye LiuQuoted 20 lines · Ye Liu
From: Ye Liu <[email protected]>
In
io_mapping_map_user(), precompute the page protection flags in a local variable before callingremap_pfn_range_notrack().No functional change.
Signed-off-by Ye Liu <[email protected]>--- mm/io-mapping.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)mm/io-mapping.c +0
-0@@ -21,9 +21,10 @@ int io_mapping_map_user(struct io_mapping *iomap, struct vm_area_struct *vma,if (WARN_ON_ONCE ((vma->vm_flags & expected_flags) != expected_flags))return -EINVAL ;
mm/io-mapping.c int io_mapping_map_user(struct io_mapping *iomap, struct vm_area_struct *vma, · line 30
Quoted 10 lines
mm/io-mapping.c +4
-3+pgprot_t remap_prot =__pgprot ((pgprot_val (iomap->prot) & _PAGE_CACHE_MASK) | + (pgprot_val (vma->vm_page_prot) & ~_PAGE_CACHE_MASK)); +/* We rely on prevalidation of the io-mapping to skip track_pfn(). */ -return remap_pfn_range_notrack (vma, addr, pfn, size, -__pgprot ((pgprot_val (iomap->prot) & _PAGE_CACHE_MASK) | - (pgprot_val (vma->vm_page_prot) & ~_PAGE_CACHE_MASK))); +return remap_pfn_range_notrack (vma, addr, pfn, size, remap_prot); }EXPORT_SYMBOL_GPL (io_mapping_map_user);
Signature · 3 lines
Cheers, David / dhildenb
Re: [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder
In reply to Ye LiuQuoted 18 lines · Ye Liu
From: Ye Liu <[email protected]>
When an invalid
debug_guardpage_minordervalue is provided, include the user input in the error message. This helps users and developers diagnose configuration issues more easily.No functional change.
Signed-off-by Ye Liu <[email protected]>--- mm/debug_page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/debug_page_alloc.c +0
-0
mm/debug_page_alloc.c static int __init debug_guardpage_minorder_setup(char *buf) · line 26
Quoted 5 lines
mm/debug_page_alloc.c +1
-1@@ -23,7 +23,7 @@ static int __init debug_guardpage_minorder_setup(char *buf)unsigned long res;if (kstrtoul (buf,10 , &res) <0 || res >MAX_PAGE_ORDER /2 ) { -pr_err ("Bad debug_guardpage_minorder value\n" ); +pr_err ("Bad debug_guardpage_minorder value: %s\n" , buf);
I would guess everybody setting that should know how to find easily out what they tried to set, but in any case
Signature · 3 lines
Cheers, David / dhildenb
Re: [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data()
In reply to Ye LiuQuoted 9 lines · Ye Liu
From: Ye Liu <[email protected]>
The temporary local variable 'nd' is redundant. Directly assign the virtual address to node_data[nid] to simplify the code.
No functional change.
Signed-off-by Ye Liu <[email protected]>---
Signature · 3 lines
Cheers, David / dhildenb
Re: [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity
In reply to Ye LiuQuoted 20 lines · Ye Liu
From: Ye Liu <[email protected]>
In
io_mapping_map_user(), precompute the page protection flags in a local variable before callingremap_pfn_range_notrack().No functional change.
Signed-off-by Ye Liu <[email protected]>--- mm/io-mapping.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)mm/io-mapping.c +0
-0@@ -21,9 +21,10 @@ int io_mapping_map_user(struct io_mapping *iomap, struct vm_area_struct *vma,if (WARN_ON_ONCE ((vma->vm_flags & expected_flags) != expected_flags))return -EINVAL ;
mm/io-mapping.c int io_mapping_map_user(struct io_mapping *iomap, struct vm_area_struct *vma, · line 30
Quoted 10 lines
mm/io-mapping.c +4
-3+pgprot_t remap_prot =__pgprot ((pgprot_val (iomap->prot) & _PAGE_CACHE_MASK) | + (pgprot_val (vma->vm_page_prot) & ~_PAGE_CACHE_MASK)); +/* We rely on prevalidation of the io-mapping to skip track_pfn(). */ -return remap_pfn_range_notrack (vma, addr, pfn, size, -__pgprot ((pgprot_val (iomap->prot) & _PAGE_CACHE_MASK) | - (pgprot_val (vma->vm_page_prot) & ~_PAGE_CACHE_MASK))); +return remap_pfn_range_notrack (vma, addr, pfn, size, remap_prot); }EXPORT_SYMBOL_GPL (io_mapping_map_user);
Re: [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder
In reply to Ye LiuQuoted 18 lines · Ye Liu
From: Ye Liu <[email protected]>
When an invalid
debug_guardpage_minordervalue is provided, include the user input in the error message. This helps users and developers diagnose configuration issues more easily.No functional change.
Signed-off-by Ye Liu <[email protected]>--- mm/debug_page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/debug_page_alloc.c +0
-0
mm/debug_page_alloc.c static int __init debug_guardpage_minorder_setup(char *buf) · line 29
Quoted 8 lines
mm/debug_page_alloc.c +1
-1@@ -23,7 +23,7 @@ static int __init debug_guardpage_minorder_setup(char *buf)unsigned long res;if (kstrtoul (buf,10 , &res) <0 || res >MAX_PAGE_ORDER /2 ) { -pr_err ("Bad debug_guardpage_minorder value\n" ); +pr_err ("Bad debug_guardpage_minorder value: %s\n" , buf);return 0 ; } _debug_guardpage_minorder = res;
Re: [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data()
In reply to Ye LiuQuoted 33 lines · Ye Liu
From: Ye Liu <[email protected]>
The temporary local variable 'nd' is redundant. Directly assign the virtual address to node_data[nid] to simplify the code.
No functional change.
Signed-off-by Ye Liu <[email protected]>--- mm/numa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)mm/numa.c +0
-2@@ -13,7 +13,6 @@ void __init alloc_node_data(int nid) {const size_t nd_size =roundup (sizeof (pg_data_t),SMP_CACHE_BYTES );u64 nd_pa; -void *nd;int tnid;/* Allocate node data. Try node-local memory and then any node. */ @@ -21,7 +20,6 @@ void __init alloc_node_data(int nid)if (!nd_pa)panic ("Cannot allocate %zu bytes for node %d data\n" , nd_size, nid); - nd =__va (nd_pa);/* report and initialize */ pr_info("NODE_DATA(%d) allocated [mem %#010Lx-%#010Lx]\n", nid,
mm/numa.c void __init alloc_node_data(int nid) · line 34
Quoted 8 lines
mm/numa.c +1
-1@@ -30,7 +28,7 @@ void __init alloc_node_data(int nid)if (tnid != nid)pr_info (" NODE_DATA(%d) on node %d\n" , nid, tnid); - node_data[nid] = nd; + node_data[nid] =__va (nd_pa);memset (NODE_DATA (nid),0 ,sizeof (pg_data_t)); }
Re: [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data()
In reply to Ye LiuQuoted 8 lines · Ye Liu
From: Ye Liu <[email protected]>
The temporary local variable 'nd' is redundant. Directly assign the virtual address to node_data[nid] to simplify the code.
No functional change.
Signed-off-by Ye Liu <[email protected]>
Quoted 36 lines
--- mm/numa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)mm/numa.c +1
-3@@ -13,7 +13,6 @@ void __init alloc_node_data(int nid) {const size_t nd_size =roundup (sizeof (pg_data_t),SMP_CACHE_BYTES );u64 nd_pa; -void *nd;int tnid;/* Allocate node data. Try node-local memory and then any node. */ @@ -21,7 +20,6 @@ void __init alloc_node_data(int nid)if (!nd_pa)panic ("Cannot allocate %zu bytes for node %d data\n" , nd_size, nid); - nd =__va (nd_pa);/* report and initialize */ pr_info("NODE_DATA(%d) allocated [mem %#010Lx-%#010Lx]\n", nid,@@ -30,7 +28,7 @@ void __init alloc_node_data(int nid)if (tnid != nid)pr_info (" NODE_DATA(%d) on node %d\n" , nid, tnid); - node_data[nid] = nd; + node_data[nid] =__va (nd_pa);memset (NODE_DATA (nid),0 ,sizeof (pg_data_t)); }Signature · 1 line
2.25.1
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity
In reply to Ye LiuQuoted 8 lines · Ye Liu
From: Ye Liu <[email protected]>
In
io_mapping_map_user(), precompute the page protection flags in a local variable before callingremap_pfn_range_notrack().No functional change.
Signed-off-by Ye Liu <[email protected]>
Quoted 25 lines
--- mm/io-mapping.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)mm/io-mapping.c +4
-3@@ -21,9 +21,10 @@ int io_mapping_map_user(struct io_mapping *iomap, struct vm_area_struct *vma,if (WARN_ON_ONCE ((vma->vm_flags & expected_flags) != expected_flags))return -EINVAL ; +pgprot_t remap_prot =__pgprot ((pgprot_val (iomap->prot) & _PAGE_CACHE_MASK) | + (pgprot_val (vma->vm_page_prot) & ~_PAGE_CACHE_MASK)); +/* We rely on prevalidation of the io-mapping to skip track_pfn(). */ -return remap_pfn_range_notrack (vma, addr, pfn, size, -__pgprot ((pgprot_val (iomap->prot) & _PAGE_CACHE_MASK) | - (pgprot_val (vma->vm_page_prot) & ~_PAGE_CACHE_MASK))); +return remap_pfn_range_notrack (vma, addr, pfn, size, remap_prot); }EXPORT_SYMBOL_GPL (io_mapping_map_user);Signature · 1 line
2.25.1
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder
In reply to Ye LiuQuoted 9 lines · Ye Liu
From: Ye Liu <[email protected]>
When an invalid
debug_guardpage_minordervalue is provided, include the user input in the error message. This helps users and developers diagnose configuration issues more easily.No functional change.
Signed-off-by Ye Liu <[email protected]>
Quoted 20 lines
--- mm/debug_page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/debug_page_alloc.c +1
-1@@ -23,7 +23,7 @@ static int __init debug_guardpage_minorder_setup(char *buf)unsigned long res;if (kstrtoul (buf,10 , &res) <0 || res >MAX_PAGE_ORDER /2 ) { -pr_err ("Bad debug_guardpage_minorder value\n" ); +pr_err ("Bad debug_guardpage_minorder value: %s\n" , buf);return 0 ; } _debug_guardpage_minorder = res;Signature · 1 line
2.25.1
Signature · 2 lines
Sincerely yours, Mike.