linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: fix ambiguous comments for better code readability
@ 2020-02-29 15:25 qiwuchen55
  2020-02-29 15:31 ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: qiwuchen55 @ 2020-02-29 15:25 UTC (permalink / raw)
  To: akpm, jgg, mhocko, kirill.shutemov, vbabka, yang.shi,
	dan.j.williams, jhubbard, thellstrom, jrdr.linux,
	mathieu.desnoyers, rcampbell
  Cc: linux-mm, chenqiwu

From: chenqiwu <chenqiwu@xiaomi.com>

The parameter of remap_pfn_range() @pfn passed from the caller is
actually a page-frame number converted by corresponding physical
address of kernel memory, the original comment is ambiguous that
may mislead the users.

Meanwhile, there is an ambiguous typo "VMM" in the comment of
vm_area_struct. So fixing them will make the code more readable.

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
 include/linux/mm_types.h | 4 ++--
 mm/memory.c              | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index dd555e6..4aba6c0 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -289,8 +289,8 @@ struct vm_userfaultfd_ctx {
 #endif /* CONFIG_USERFAULTFD */
 
 /*
- * This struct defines a memory VMM memory area. There is one of these
- * per VM-area/task.  A VM area is any part of the process virtual memory
+ * This struct describes a virtual memory area. There is one of these
+ * per VM-area/task. A VM area is any part of the process virtual memory
  * space that has a special rule for the page-fault handlers (ie a shared
  * library, the executable area etc).
  */
diff --git a/mm/memory.c b/mm/memory.c
index ce4b2b9..778aa00 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1948,8 +1948,8 @@ static inline int remap_p4d_range(struct mm_struct *mm, pgd_t *pgd,
  * remap_pfn_range - remap kernel memory to userspace
  * @vma: user vma to map to
  * @addr: target user address to start at
- * @pfn: physical address of kernel memory
- * @size: size of map area
+ * @pfn: remap pfn converted by physical address of kernel memory
+ * @size: size of mapping area
  * @prot: page protection flags for this mapping
  *
  * Note: this is only safe if the mm semaphore is held when called.
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: fix ambiguous comments for better code readability
  2020-02-29 15:25 [PATCH] mm: fix ambiguous comments for better code readability qiwuchen55
@ 2020-02-29 15:31 ` Matthew Wilcox
  2020-02-29 15:43   ` chenqiwu
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2020-02-29 15:31 UTC (permalink / raw)
  To: qiwuchen55
  Cc: akpm, jgg, mhocko, kirill.shutemov, vbabka, yang.shi,
	dan.j.williams, jhubbard, thellstrom, jrdr.linux,
	mathieu.desnoyers, rcampbell, linux-mm, chenqiwu

On Sat, Feb 29, 2020 at 11:25:49PM +0800, qiwuchen55@gmail.com wrote:
> +++ b/mm/memory.c
> @@ -1948,8 +1948,8 @@ static inline int remap_p4d_range(struct mm_struct *mm, pgd_t *pgd,
>   * remap_pfn_range - remap kernel memory to userspace
>   * @vma: user vma to map to
>   * @addr: target user address to start at
> - * @pfn: physical address of kernel memory
> - * @size: size of map area
> + * @pfn: remap pfn converted by physical address of kernel memory

I think that's actually worse.  How about:

 * @pfn: Page Frame Number of memory.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: fix ambiguous comments for better code readability
  2020-02-29 15:31 ` Matthew Wilcox
@ 2020-02-29 15:43   ` chenqiwu
  2020-03-01  3:17     ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: chenqiwu @ 2020-02-29 15:43 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: akpm, jgg, mhocko, kirill.shutemov, vbabka, yang.shi,
	dan.j.williams, jhubbard, thellstrom, jrdr.linux,
	mathieu.desnoyers, rcampbell, linux-mm, chenqiwu

On Sat, Feb 29, 2020 at 07:31:23AM -0800, Matthew Wilcox wrote:
> On Sat, Feb 29, 2020 at 11:25:49PM +0800, qiwuchen55@gmail.com wrote:
> > +++ b/mm/memory.c
> > @@ -1948,8 +1948,8 @@ static inline int remap_p4d_range(struct mm_struct *mm, pgd_t *pgd,
> >   * remap_pfn_range - remap kernel memory to userspace
> >   * @vma: user vma to map to
> >   * @addr: target user address to start at
> > - * @pfn: physical address of kernel memory
> > - * @size: size of map area
> > + * @pfn: remap pfn converted by physical address of kernel memory
> 
> I think that's actually worse.  How about:
> 
>  * @pfn: Page Frame Number of memory.

Hmm... I think "Page Frame Number of kernel memory" should be better.
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: fix ambiguous comments for better code readability
  2020-02-29 15:43   ` chenqiwu
@ 2020-03-01  3:17     ` Matthew Wilcox
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2020-03-01  3:17 UTC (permalink / raw)
  To: chenqiwu
  Cc: akpm, jgg, mhocko, kirill.shutemov, vbabka, yang.shi,
	dan.j.williams, jhubbard, thellstrom, jrdr.linux,
	mathieu.desnoyers, rcampbell, linux-mm, chenqiwu

On Sat, Feb 29, 2020 at 11:43:17PM +0800, chenqiwu wrote:
> On Sat, Feb 29, 2020 at 07:31:23AM -0800, Matthew Wilcox wrote:
> > On Sat, Feb 29, 2020 at 11:25:49PM +0800, qiwuchen55@gmail.com wrote:
> > > +++ b/mm/memory.c
> > > @@ -1948,8 +1948,8 @@ static inline int remap_p4d_range(struct mm_struct *mm, pgd_t *pgd,
> > >   * remap_pfn_range - remap kernel memory to userspace
> > >   * @vma: user vma to map to
> > >   * @addr: target user address to start at
> > > - * @pfn: physical address of kernel memory
> > > - * @size: size of map area
> > > + * @pfn: remap pfn converted by physical address of kernel memory
> > 
> > I think that's actually worse.  How about:
> > 
> >  * @pfn: Page Frame Number of memory.
> 
> Hmm... I think "Page Frame Number of kernel memory" should be better.

I disagree.  We already know the memory is kernel memory from the first
line.  Repeating this information in the parameter description isn't
particularly helpful.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-01  3:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-29 15:25 [PATCH] mm: fix ambiguous comments for better code readability qiwuchen55
2020-02-29 15:31 ` Matthew Wilcox
2020-02-29 15:43   ` chenqiwu
2020-03-01  3:17     ` Matthew Wilcox

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).