* [PATCH 0/3] mm: small cleanups for io-mapping, debug_page_alloc and numa
@ 2025-04-27 10:04 Ye Liu
2025-04-27 10:04 ` [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity Ye Liu
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Ye Liu @ 2025-04-27 10:04 UTC (permalink / raw)
To: akpm
Cc: linux-kernel, linux-mm, rppt, lorenzo.stoakes, Liam.Howlett,
david, harry.yoo, riel, vbabka, liuye, ye.liu
From: Ye Liu <liuye@kylinos.cn>
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(-)
--
2.25.1
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity 2025-04-27 10:04 [PATCH 0/3] mm: small cleanups for io-mapping, debug_page_alloc and numa Ye Liu @ 2025-04-27 10:04 ` Ye Liu 2025-04-28 7:18 ` David Hildenbrand ` (2 more replies) 2025-04-27 10:04 ` [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder Ye Liu 2025-04-27 10:04 ` [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data() Ye Liu 2 siblings, 3 replies; 13+ messages in thread From: Ye Liu @ 2025-04-27 10:04 UTC (permalink / raw) To: akpm Cc: linux-kernel, linux-mm, rppt, lorenzo.stoakes, Liam.Howlett, david, harry.yoo, riel, vbabka, liuye, ye.liu From: Ye Liu <liuye@kylinos.cn> In io_mapping_map_user(), precompute the page protection flags in a local variable before calling remap_pfn_range_notrack(). No functional change. Signed-off-by: Ye Liu <liuye@kylinos.cn> --- mm/io-mapping.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/io-mapping.c b/mm/io-mapping.c index 01b362799930..f44a6a134712 100644 --- a/mm/io-mapping.c +++ b/mm/io-mapping.c @@ -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); -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity 2025-04-27 10:04 ` [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity Ye Liu @ 2025-04-28 7:18 ` David Hildenbrand 2025-04-28 12:15 ` Anshuman Khandual 2025-04-29 6:33 ` Mike Rapoport 2 siblings, 0 replies; 13+ messages in thread From: David Hildenbrand @ 2025-04-28 7:18 UTC (permalink / raw) To: Ye Liu, akpm Cc: linux-kernel, linux-mm, rppt, lorenzo.stoakes, Liam.Howlett, harry.yoo, riel, vbabka, liuye On 27.04.25 12:04, Ye Liu wrote: > From: Ye Liu <liuye@kylinos.cn> > > In io_mapping_map_user(), precompute the page protection flags in a local > variable before calling remap_pfn_range_notrack(). > > No functional change. > > Signed-off-by: Ye Liu <liuye@kylinos.cn> > --- > mm/io-mapping.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/mm/io-mapping.c b/mm/io-mapping.c > index 01b362799930..f44a6a134712 100644 > --- a/mm/io-mapping.c > +++ b/mm/io-mapping.c > @@ -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); Reviewed-by: David Hildenbrand <david@redhat.com> -- Cheers, David / dhildenb ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity 2025-04-27 10:04 ` [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity Ye Liu 2025-04-28 7:18 ` David Hildenbrand @ 2025-04-28 12:15 ` Anshuman Khandual 2025-04-29 6:33 ` Mike Rapoport 2 siblings, 0 replies; 13+ messages in thread From: Anshuman Khandual @ 2025-04-28 12:15 UTC (permalink / raw) To: Ye Liu, akpm Cc: linux-kernel, linux-mm, rppt, lorenzo.stoakes, Liam.Howlett, david, harry.yoo, riel, vbabka, liuye On 4/27/25 15:34, Ye Liu wrote: > From: Ye Liu <liuye@kylinos.cn> > > In io_mapping_map_user(), precompute the page protection flags in a local > variable before calling remap_pfn_range_notrack(). > > No functional change. > > Signed-off-by: Ye Liu <liuye@kylinos.cn> > --- > mm/io-mapping.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/mm/io-mapping.c b/mm/io-mapping.c > index 01b362799930..f44a6a134712 100644 > --- a/mm/io-mapping.c > +++ b/mm/io-mapping.c > @@ -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); Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity 2025-04-27 10:04 ` [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity Ye Liu 2025-04-28 7:18 ` David Hildenbrand 2025-04-28 12:15 ` Anshuman Khandual @ 2025-04-29 6:33 ` Mike Rapoport 2 siblings, 0 replies; 13+ messages in thread From: Mike Rapoport @ 2025-04-29 6:33 UTC (permalink / raw) To: Ye Liu Cc: akpm, linux-kernel, linux-mm, lorenzo.stoakes, Liam.Howlett, david, harry.yoo, riel, vbabka, liuye On Sun, Apr 27, 2025 at 06:04:40PM +0800, Ye Liu wrote: > From: Ye Liu <liuye@kylinos.cn> > > In io_mapping_map_user(), precompute the page protection flags in a local > variable before calling remap_pfn_range_notrack(). > > No functional change. > > Signed-off-by: Ye Liu <liuye@kylinos.cn> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> > --- > mm/io-mapping.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/mm/io-mapping.c b/mm/io-mapping.c > index 01b362799930..f44a6a134712 100644 > --- a/mm/io-mapping.c > +++ b/mm/io-mapping.c > @@ -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); > -- > 2.25.1 > -- Sincerely yours, Mike. ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder 2025-04-27 10:04 [PATCH 0/3] mm: small cleanups for io-mapping, debug_page_alloc and numa Ye Liu 2025-04-27 10:04 ` [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity Ye Liu @ 2025-04-27 10:04 ` Ye Liu 2025-04-28 7:21 ` David Hildenbrand ` (2 more replies) 2025-04-27 10:04 ` [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data() Ye Liu 2 siblings, 3 replies; 13+ messages in thread From: Ye Liu @ 2025-04-27 10:04 UTC (permalink / raw) To: akpm Cc: linux-kernel, linux-mm, rppt, lorenzo.stoakes, Liam.Howlett, david, harry.yoo, riel, vbabka, liuye, ye.liu From: Ye Liu <liuye@kylinos.cn> 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. Signed-off-by: Ye Liu <liuye@kylinos.cn> --- mm/debug_page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/debug_page_alloc.c b/mm/debug_page_alloc.c index d46acf989dde..6a26eca546c3 100644 --- a/mm/debug_page_alloc.c +++ b/mm/debug_page_alloc.c @@ -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; -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder 2025-04-27 10:04 ` [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder Ye Liu @ 2025-04-28 7:21 ` David Hildenbrand 2025-04-28 12:24 ` Anshuman Khandual 2025-04-29 7:29 ` Mike Rapoport 2 siblings, 0 replies; 13+ messages in thread From: David Hildenbrand @ 2025-04-28 7:21 UTC (permalink / raw) To: Ye Liu, akpm Cc: linux-kernel, linux-mm, rppt, lorenzo.stoakes, Liam.Howlett, harry.yoo, riel, vbabka, liuye On 27.04.25 12:04, Ye Liu wrote: > From: Ye Liu <liuye@kylinos.cn> > > 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. > > Signed-off-by: Ye Liu <liuye@kylinos.cn> > --- > mm/debug_page_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/debug_page_alloc.c b/mm/debug_page_alloc.c > index d46acf989dde..6a26eca546c3 100644 > --- a/mm/debug_page_alloc.c > +++ b/mm/debug_page_alloc.c > @@ -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 Acked-by: David Hildenbrand <david@redhat.com> -- Cheers, David / dhildenb ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder 2025-04-27 10:04 ` [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder Ye Liu 2025-04-28 7:21 ` David Hildenbrand @ 2025-04-28 12:24 ` Anshuman Khandual 2025-04-29 7:29 ` Mike Rapoport 2 siblings, 0 replies; 13+ messages in thread From: Anshuman Khandual @ 2025-04-28 12:24 UTC (permalink / raw) To: Ye Liu, akpm Cc: linux-kernel, linux-mm, rppt, lorenzo.stoakes, Liam.Howlett, david, harry.yoo, riel, vbabka, liuye On 4/27/25 15:34, Ye Liu wrote: > From: Ye Liu <liuye@kylinos.cn> > > 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. > > Signed-off-by: Ye Liu <liuye@kylinos.cn> > --- > mm/debug_page_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/debug_page_alloc.c b/mm/debug_page_alloc.c > index d46acf989dde..6a26eca546c3 100644 > --- a/mm/debug_page_alloc.c > +++ b/mm/debug_page_alloc.c > @@ -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; Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder 2025-04-27 10:04 ` [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder Ye Liu 2025-04-28 7:21 ` David Hildenbrand 2025-04-28 12:24 ` Anshuman Khandual @ 2025-04-29 7:29 ` Mike Rapoport 2 siblings, 0 replies; 13+ messages in thread From: Mike Rapoport @ 2025-04-29 7:29 UTC (permalink / raw) To: Ye Liu Cc: akpm, linux-kernel, linux-mm, lorenzo.stoakes, Liam.Howlett, david, harry.yoo, riel, vbabka, liuye On Sun, Apr 27, 2025 at 06:04:41PM +0800, Ye Liu wrote: > From: Ye Liu <liuye@kylinos.cn> > > 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. > > Signed-off-by: Ye Liu <liuye@kylinos.cn> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> > --- > mm/debug_page_alloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/debug_page_alloc.c b/mm/debug_page_alloc.c > index d46acf989dde..6a26eca546c3 100644 > --- a/mm/debug_page_alloc.c > +++ b/mm/debug_page_alloc.c > @@ -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; > -- > 2.25.1 > -- Sincerely yours, Mike. ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data() 2025-04-27 10:04 [PATCH 0/3] mm: small cleanups for io-mapping, debug_page_alloc and numa Ye Liu 2025-04-27 10:04 ` [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity Ye Liu 2025-04-27 10:04 ` [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder Ye Liu @ 2025-04-27 10:04 ` Ye Liu 2025-04-28 7:22 ` David Hildenbrand ` (2 more replies) 2 siblings, 3 replies; 13+ messages in thread From: Ye Liu @ 2025-04-27 10:04 UTC (permalink / raw) To: akpm Cc: linux-kernel, linux-mm, rppt, lorenzo.stoakes, Liam.Howlett, david, harry.yoo, riel, vbabka, liuye, ye.liu From: Ye Liu <liuye@kylinos.cn> 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 <liuye@kylinos.cn> --- mm/numa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/numa.c b/mm/numa.c index f1787d7713a6..7d5e06fe5bd4 100644 --- a/mm/numa.c +++ b/mm/numa.c @@ -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)); } -- 2.25.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data() 2025-04-27 10:04 ` [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data() Ye Liu @ 2025-04-28 7:22 ` David Hildenbrand 2025-04-29 4:03 ` Anshuman Khandual 2025-04-29 6:32 ` Mike Rapoport 2 siblings, 0 replies; 13+ messages in thread From: David Hildenbrand @ 2025-04-28 7:22 UTC (permalink / raw) To: Ye Liu, akpm Cc: linux-kernel, linux-mm, rppt, lorenzo.stoakes, Liam.Howlett, harry.yoo, riel, vbabka, liuye On 27.04.25 12:04, Ye Liu wrote: > From: Ye Liu <liuye@kylinos.cn> > > 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 <liuye@kylinos.cn> > --- Acked-by: David Hildenbrand <david@redhat.com> -- Cheers, David / dhildenb ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data() 2025-04-27 10:04 ` [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data() Ye Liu 2025-04-28 7:22 ` David Hildenbrand @ 2025-04-29 4:03 ` Anshuman Khandual 2025-04-29 6:32 ` Mike Rapoport 2 siblings, 0 replies; 13+ messages in thread From: Anshuman Khandual @ 2025-04-29 4:03 UTC (permalink / raw) To: Ye Liu, akpm Cc: linux-kernel, linux-mm, rppt, lorenzo.stoakes, Liam.Howlett, david, harry.yoo, riel, vbabka, liuye On 4/27/25 15:34, Ye Liu wrote: > From: Ye Liu <liuye@kylinos.cn> > > 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 <liuye@kylinos.cn> > --- > mm/numa.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/mm/numa.c b/mm/numa.c > index f1787d7713a6..7d5e06fe5bd4 100644 > --- a/mm/numa.c > +++ b/mm/numa.c > @@ -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)); > } > Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data() 2025-04-27 10:04 ` [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data() Ye Liu 2025-04-28 7:22 ` David Hildenbrand 2025-04-29 4:03 ` Anshuman Khandual @ 2025-04-29 6:32 ` Mike Rapoport 2 siblings, 0 replies; 13+ messages in thread From: Mike Rapoport @ 2025-04-29 6:32 UTC (permalink / raw) To: Ye Liu Cc: akpm, linux-kernel, linux-mm, lorenzo.stoakes, Liam.Howlett, david, harry.yoo, riel, vbabka, liuye On Sun, Apr 27, 2025 at 06:04:42PM +0800, Ye Liu wrote: > From: Ye Liu <liuye@kylinos.cn> > > 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 <liuye@kylinos.cn> Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> > --- > mm/numa.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/mm/numa.c b/mm/numa.c > index f1787d7713a6..7d5e06fe5bd4 100644 > --- a/mm/numa.c > +++ b/mm/numa.c > @@ -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)); > } > > -- > 2.25.1 > -- Sincerely yours, Mike. ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-04-29 7:30 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-04-27 10:04 [PATCH 0/3] mm: small cleanups for io-mapping, debug_page_alloc and numa Ye Liu 2025-04-27 10:04 ` [PATCH 1/3] mm/io-mapping: precompute remap protection flags for clarity Ye Liu 2025-04-28 7:18 ` David Hildenbrand 2025-04-28 12:15 ` Anshuman Khandual 2025-04-29 6:33 ` Mike Rapoport 2025-04-27 10:04 ` [PATCH 2/3] mm/debug_page_alloc: improve error message for invalid guardpage minorder Ye Liu 2025-04-28 7:21 ` David Hildenbrand 2025-04-28 12:24 ` Anshuman Khandual 2025-04-29 7:29 ` Mike Rapoport 2025-04-27 10:04 ` [PATCH 3/3] mm/numa: remove unnecessary local variable in alloc_node_data() Ye Liu 2025-04-28 7:22 ` David Hildenbrand 2025-04-29 4:03 ` Anshuman Khandual 2025-04-29 6:32 ` Mike Rapoport
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox