* [PATCH v3 2/2] drivers/base/memory.c: Rename the misleading parameter
2019-03-29 8:29 [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment Baoquan He
@ 2019-03-29 8:29 ` Baoquan He
2019-03-29 9:13 ` Michal Hocko
2019-03-29 9:36 ` [PATCH v4 " Baoquan He
2019-03-29 9:14 ` [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment Michal Hocko
` (3 subsequent siblings)
4 siblings, 2 replies; 14+ messages in thread
From: Baoquan He @ 2019-03-29 8:29 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, rafael, akpm, mhocko, osalvador, rppt, willy,
fanc.fnst, Baoquan He
The input parameter 'phys_index' of memory_block_action() is actually
the section number, but not the phys_index of memory_block. Fix it.
Signed-off-by: Baoquan He <bhe@redhat.com>
---
v2->v3:
Rename the parameter to 'start_section_nr' from 'sec'.
drivers/base/memory.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index cb8347500ce2..9ea972b2ae79 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -231,13 +231,14 @@ static bool pages_correctly_probed(unsigned long start_pfn)
* OK to have direct references to sparsemem variables in here.
*/
static int
-memory_block_action(unsigned long phys_index, unsigned long action, int online_type)
+memory_block_action(unsigned long start_section_nr, unsigned long action,
+ int online_type)
{
unsigned long start_pfn;
unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
int ret;
- start_pfn = section_nr_to_pfn(phys_index);
+ start_pfn = section_nr_to_pfn(start_section_nr);
switch (action) {
case MEM_ONLINE:
@@ -251,7 +252,7 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t
break;
default:
WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: "
- "%ld\n", __func__, phys_index, action, action);
+ "%ld\n", __func__, start_section_nr, action, action);
ret = -EINVAL;
}
--
2.17.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v3 2/2] drivers/base/memory.c: Rename the misleading parameter
2019-03-29 8:29 ` [PATCH v3 2/2] drivers/base/memory.c: Rename the misleading parameter Baoquan He
@ 2019-03-29 9:13 ` Michal Hocko
2019-03-29 9:19 ` Baoquan He
2019-03-29 9:37 ` Oscar Salvador
2019-03-29 9:36 ` [PATCH v4 " Baoquan He
1 sibling, 2 replies; 14+ messages in thread
From: Michal Hocko @ 2019-03-29 9:13 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-mm, rafael, akpm, osalvador, rppt, willy, fanc.fnst
On Fri 29-03-19 16:29:15, Baoquan He wrote:
> The input parameter 'phys_index' of memory_block_action() is actually
> the section number, but not the phys_index of memory_block. Fix it.
I have tried to explain that the naming is mostly a relict from the past
than really a misleading name http://lkml.kernel.org/r/20190326093315.GL28406@dhcp22.suse.cz
Maybe it would be good to reflect that in the changelog
> Signed-off-by: Baoquan He <bhe@redhat.com>
btw. I've acked the previous version as well.
> ---
> v2->v3:
> Rename the parameter to 'start_section_nr' from 'sec'.
>
> drivers/base/memory.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index cb8347500ce2..9ea972b2ae79 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -231,13 +231,14 @@ static bool pages_correctly_probed(unsigned long start_pfn)
> * OK to have direct references to sparsemem variables in here.
> */
> static int
> -memory_block_action(unsigned long phys_index, unsigned long action, int online_type)
> +memory_block_action(unsigned long start_section_nr, unsigned long action,
> + int online_type)
> {
> unsigned long start_pfn;
> unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
> int ret;
>
> - start_pfn = section_nr_to_pfn(phys_index);
> + start_pfn = section_nr_to_pfn(start_section_nr);
>
> switch (action) {
> case MEM_ONLINE:
> @@ -251,7 +252,7 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t
> break;
> default:
> WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: "
> - "%ld\n", __func__, phys_index, action, action);
> + "%ld\n", __func__, start_section_nr, action, action);
> ret = -EINVAL;
> }
>
> --
> 2.17.2
>
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 2/2] drivers/base/memory.c: Rename the misleading parameter
2019-03-29 9:13 ` Michal Hocko
@ 2019-03-29 9:19 ` Baoquan He
2019-03-29 9:37 ` Oscar Salvador
1 sibling, 0 replies; 14+ messages in thread
From: Baoquan He @ 2019-03-29 9:19 UTC (permalink / raw)
To: Michal Hocko
Cc: linux-kernel, linux-mm, rafael, akpm, osalvador, rppt, willy, fanc.fnst
On 03/29/19 at 10:13am, Michal Hocko wrote:
> On Fri 29-03-19 16:29:15, Baoquan He wrote:
> > The input parameter 'phys_index' of memory_block_action() is actually
> > the section number, but not the phys_index of memory_block. Fix it.
>
> I have tried to explain that the naming is mostly a relict from the past
> than really a misleading name http://lkml.kernel.org/r/20190326093315.GL28406@dhcp22.suse.cz
> Maybe it would be good to reflect that in the changelog
>
> > Signed-off-by: Baoquan He <bhe@redhat.com>
>
> btw. I've acked the previous version as well.
Sure, will rewrite the log and add people's Acked-by tag. Thanks.
>
> > ---
> > v2->v3:
> > Rename the parameter to 'start_section_nr' from 'sec'.
> >
> > drivers/base/memory.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> > index cb8347500ce2..9ea972b2ae79 100644
> > --- a/drivers/base/memory.c
> > +++ b/drivers/base/memory.c
> > @@ -231,13 +231,14 @@ static bool pages_correctly_probed(unsigned long start_pfn)
> > * OK to have direct references to sparsemem variables in here.
> > */
> > static int
> > -memory_block_action(unsigned long phys_index, unsigned long action, int online_type)
> > +memory_block_action(unsigned long start_section_nr, unsigned long action,
> > + int online_type)
> > {
> > unsigned long start_pfn;
> > unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
> > int ret;
> >
> > - start_pfn = section_nr_to_pfn(phys_index);
> > + start_pfn = section_nr_to_pfn(start_section_nr);
> >
> > switch (action) {
> > case MEM_ONLINE:
> > @@ -251,7 +252,7 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t
> > break;
> > default:
> > WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: "
> > - "%ld\n", __func__, phys_index, action, action);
> > + "%ld\n", __func__, start_section_nr, action, action);
> > ret = -EINVAL;
> > }
> >
> > --
> > 2.17.2
> >
>
> --
> Michal Hocko
> SUSE Labs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 2/2] drivers/base/memory.c: Rename the misleading parameter
2019-03-29 9:13 ` Michal Hocko
2019-03-29 9:19 ` Baoquan He
@ 2019-03-29 9:37 ` Oscar Salvador
2019-03-29 12:55 ` Baoquan He
1 sibling, 1 reply; 14+ messages in thread
From: Oscar Salvador @ 2019-03-29 9:37 UTC (permalink / raw)
To: Michal Hocko
Cc: Baoquan He, linux-kernel, linux-mm, rafael, akpm, rppt, willy, fanc.fnst
On Fri, Mar 29, 2019 at 10:13:25AM +0100, Michal Hocko wrote:
> On Fri 29-03-19 16:29:15, Baoquan He wrote:
> > The input parameter 'phys_index' of memory_block_action() is actually
> > the section number, but not the phys_index of memory_block. Fix it.
>
> I have tried to explain that the naming is mostly a relict from the past
> than really a misleading name http://lkml.kernel.org/r/20190326093315.GL28406@dhcp22.suse.cz
> Maybe it would be good to reflect that in the changelog
I think that phys_device variable in remove_memory_section() is also a relict
from the past, and it is no longer used.
Neither node_id variable is used.
Actually, unregister_memory_section() sets those two to 0 no matter what.
Since we are cleaning up, I wonder if we can go a bit further and we can get
rid of that as well.
--
Oscar Salvador
SUSE L3
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 2/2] drivers/base/memory.c: Rename the misleading parameter
2019-03-29 9:37 ` Oscar Salvador
@ 2019-03-29 12:55 ` Baoquan He
0 siblings, 0 replies; 14+ messages in thread
From: Baoquan He @ 2019-03-29 12:55 UTC (permalink / raw)
To: Oscar Salvador
Cc: Michal Hocko, linux-kernel, linux-mm, rafael, akpm, rppt, willy,
fanc.fnst
On 03/29/19 at 10:37am, Oscar Salvador wrote:
> On Fri, Mar 29, 2019 at 10:13:25AM +0100, Michal Hocko wrote:
> > On Fri 29-03-19 16:29:15, Baoquan He wrote:
> > > The input parameter 'phys_index' of memory_block_action() is actually
> > > the section number, but not the phys_index of memory_block. Fix it.
> >
> > I have tried to explain that the naming is mostly a relict from the past
> > than really a misleading name http://lkml.kernel.org/r/20190326093315.GL28406@dhcp22.suse.cz
> > Maybe it would be good to reflect that in the changelog
>
> I think that phys_device variable in remove_memory_section() is also a relict
> from the past, and it is no longer used.
> Neither node_id variable is used.
> Actually, unregister_memory_section() sets those two to 0 no matter what.
>
> Since we are cleaning up, I wonder if we can go a bit further and we can get
> rid of that as well.
Yes, certainly. I would like to post a new one to carry this.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v4 2/2] drivers/base/memory.c: Rename the misleading parameter
2019-03-29 8:29 ` [PATCH v3 2/2] drivers/base/memory.c: Rename the misleading parameter Baoquan He
2019-03-29 9:13 ` Michal Hocko
@ 2019-03-29 9:36 ` Baoquan He
2019-03-29 10:32 ` Oscar Salvador
2019-03-29 10:43 ` Mukesh Ojha
1 sibling, 2 replies; 14+ messages in thread
From: Baoquan He @ 2019-03-29 9:36 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, rafael, akpm, mhocko, osalvador, rppt, willy, fanc.fnst
The input parameter 'phys_index' of memory_block_action() is actually
the section number, but not the phys_index of memory_block. This is
a relict from the past when one memory block could only contain one
section.
Rename it to start_section_nr.
Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/base/memory.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index cb8347500ce2..9ea972b2ae79 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -231,13 +231,14 @@ static bool pages_correctly_probed(unsigned long start_pfn)
* OK to have direct references to sparsemem variables in here.
*/
static int
-memory_block_action(unsigned long phys_index, unsigned long action, int online_type)
+memory_block_action(unsigned long start_section_nr, unsigned long action,
+ int online_type)
{
unsigned long start_pfn;
unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
int ret;
- start_pfn = section_nr_to_pfn(phys_index);
+ start_pfn = section_nr_to_pfn(start_section_nr);
switch (action) {
case MEM_ONLINE:
@@ -251,7 +252,7 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t
break;
default:
WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: "
- "%ld\n", __func__, phys_index, action, action);
+ "%ld\n", __func__, start_section_nr, action, action);
ret = -EINVAL;
}
--
2.17.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v4 2/2] drivers/base/memory.c: Rename the misleading parameter
2019-03-29 9:36 ` [PATCH v4 " Baoquan He
@ 2019-03-29 10:32 ` Oscar Salvador
2019-03-29 10:43 ` Mukesh Ojha
1 sibling, 0 replies; 14+ messages in thread
From: Oscar Salvador @ 2019-03-29 10:32 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-mm, rafael, akpm, mhocko, rppt, willy, fanc.fnst
On Fri, Mar 29, 2019 at 05:36:59PM +0800, Baoquan He wrote:
> The input parameter 'phys_index' of memory_block_action() is actually
> the section number, but not the phys_index of memory_block. This is
> a relict from the past when one memory block could only contain one
> section.
>
> Rename it to start_section_nr.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Acked-by: Michal Hocko <mhocko@suse.com>
> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
> drivers/base/memory.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index cb8347500ce2..9ea972b2ae79 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -231,13 +231,14 @@ static bool pages_correctly_probed(unsigned long start_pfn)
> * OK to have direct references to sparsemem variables in here.
> */
> static int
> -memory_block_action(unsigned long phys_index, unsigned long action, int online_type)
> +memory_block_action(unsigned long start_section_nr, unsigned long action,
> + int online_type)
> {
> unsigned long start_pfn;
> unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
> int ret;
>
> - start_pfn = section_nr_to_pfn(phys_index);
> + start_pfn = section_nr_to_pfn(start_section_nr);
>
> switch (action) {
> case MEM_ONLINE:
> @@ -251,7 +252,7 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t
> break;
> default:
> WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: "
> - "%ld\n", __func__, phys_index, action, action);
> + "%ld\n", __func__, start_section_nr, action, action);
> ret = -EINVAL;
> }
>
> --
> 2.17.2
>
--
Oscar Salvador
SUSE L3
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v4 2/2] drivers/base/memory.c: Rename the misleading parameter
2019-03-29 9:36 ` [PATCH v4 " Baoquan He
2019-03-29 10:32 ` Oscar Salvador
@ 2019-03-29 10:43 ` Mukesh Ojha
1 sibling, 0 replies; 14+ messages in thread
From: Mukesh Ojha @ 2019-03-29 10:43 UTC (permalink / raw)
To: Baoquan He, linux-kernel
Cc: linux-mm, rafael, akpm, mhocko, osalvador, rppt, willy, fanc.fnst
On 3/29/2019 3:06 PM, Baoquan He wrote:
> The input parameter 'phys_index' of memory_block_action() is actually
> the section number, but not the phys_index of memory_block. This is
> a relict from the past when one memory block could only contain one
> section.
>
> Rename it to start_section_nr.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Acked-by: Michal Hocko <mhocko@suse.com>
> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Cheers,
-Mukesh
> ---
> drivers/base/memory.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index cb8347500ce2..9ea972b2ae79 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -231,13 +231,14 @@ static bool pages_correctly_probed(unsigned long start_pfn)
> * OK to have direct references to sparsemem variables in here.
> */
> static int
> -memory_block_action(unsigned long phys_index, unsigned long action, int online_type)
> +memory_block_action(unsigned long start_section_nr, unsigned long action,
> + int online_type)
> {
> unsigned long start_pfn;
> unsigned long nr_pages = PAGES_PER_SECTION * sections_per_block;
> int ret;
>
> - start_pfn = section_nr_to_pfn(phys_index);
> + start_pfn = section_nr_to_pfn(start_section_nr);
>
> switch (action) {
> case MEM_ONLINE:
> @@ -251,7 +252,7 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t
> break;
> default:
> WARN(1, KERN_WARNING "%s(%ld, %ld) unknown action: "
> - "%ld\n", __func__, phys_index, action, action);
> + "%ld\n", __func__, start_section_nr, action, action);
> ret = -EINVAL;
> }
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment
2019-03-29 8:29 [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment Baoquan He
2019-03-29 8:29 ` [PATCH v3 2/2] drivers/base/memory.c: Rename the misleading parameter Baoquan He
@ 2019-03-29 9:14 ` Michal Hocko
2019-03-29 10:36 ` Oscar Salvador
` (2 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Michal Hocko @ 2019-03-29 9:14 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-mm, rafael, akpm, osalvador, rppt, willy, fanc.fnst
On Fri 29-03-19 16:29:14, Baoquan He wrote:
> The code comment above sparse_add_one_section() is obsolete and
> incorrect, clean it up and write new one.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> v2->v3:
> Normalize the code comment to use '/**' at 1st line of doc
> above function.
> v1-v2:
> Add comments to explain what the returned value means for
> each error code.
> mm/sparse.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 69904aa6165b..363f9d31b511 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -684,10 +684,19 @@ static void free_map_bootmem(struct page *memmap)
> #endif /* CONFIG_MEMORY_HOTREMOVE */
> #endif /* CONFIG_SPARSEMEM_VMEMMAP */
>
> -/*
> - * returns the number of sections whose mem_maps were properly
> - * set. If this is <=0, then that means that the passed-in
> - * map was not consumed and must be freed.
> +/**
> + * sparse_add_one_section - add a memory section
> + * @nid: The node to add section on
> + * @start_pfn: start pfn of the memory range
> + * @altmap: device page map
> + *
> + * This is only intended for hotplug.
> + *
> + * Returns:
> + * 0 on success.
> + * Other error code on failure:
> + * - -EEXIST - section has been present.
> + * - -ENOMEM - out of memory.
> */
> int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,
> struct vmem_altmap *altmap)
> --
> 2.17.2
>
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment
2019-03-29 8:29 [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment Baoquan He
2019-03-29 8:29 ` [PATCH v3 2/2] drivers/base/memory.c: Rename the misleading parameter Baoquan He
2019-03-29 9:14 ` [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment Michal Hocko
@ 2019-03-29 10:36 ` Oscar Salvador
2019-03-29 13:59 ` Baoquan He
2019-03-29 10:40 ` Mukesh Ojha
2019-03-30 9:50 ` Mike Rapoport
4 siblings, 1 reply; 14+ messages in thread
From: Oscar Salvador @ 2019-03-29 10:36 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-mm, rafael, akpm, mhocko, rppt, willy, fanc.fnst
On Fri, Mar 29, 2019 at 04:29:14PM +0800, Baoquan He wrote:
> The code comment above sparse_add_one_section() is obsolete and
> incorrect, clean it up and write new one.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
> ---
> v2->v3:
> Normalize the code comment to use '/**' at 1st line of doc
> above function.
> v1-v2:
> Add comments to explain what the returned value means for
> each error code.
> mm/sparse.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 69904aa6165b..363f9d31b511 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -684,10 +684,19 @@ static void free_map_bootmem(struct page *memmap)
> #endif /* CONFIG_MEMORY_HOTREMOVE */
> #endif /* CONFIG_SPARSEMEM_VMEMMAP */
>
> -/*
> - * returns the number of sections whose mem_maps were properly
> - * set. If this is <=0, then that means that the passed-in
> - * map was not consumed and must be freed.
> +/**
> + * sparse_add_one_section - add a memory section
> + * @nid: The node to add section on
> + * @start_pfn: start pfn of the memory range
> + * @altmap: device page map
> + *
> + * This is only intended for hotplug.
> + *
> + * Returns:
> + * 0 on success.
> + * Other error code on failure:
> + * - -EEXIST - section has been present.
> + * - -ENOMEM - out of memory.
I am not really into kernel-doc format, but I thought it was something like:
<--
Return:
0: success
-EEXIST: Section is already present
-ENOMEM: Out of memory
-->
But as I said, I might very well be wrong.
--
Oscar Salvador
SUSE L3
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment
2019-03-29 10:36 ` Oscar Salvador
@ 2019-03-29 13:59 ` Baoquan He
0 siblings, 0 replies; 14+ messages in thread
From: Baoquan He @ 2019-03-29 13:59 UTC (permalink / raw)
To: Oscar Salvador
Cc: linux-kernel, linux-mm, rafael, akpm, mhocko, rppt, willy, fanc.fnst
On 03/29/19 at 11:36am, Oscar Salvador wrote:
> > +/**
> > + * sparse_add_one_section - add a memory section
> > + * @nid: The node to add section on
> > + * @start_pfn: start pfn of the memory range
> > + * @altmap: device page map
> > + *
> > + * This is only intended for hotplug.
> > + *
> > + * Returns:
> > + * 0 on success.
> > + * Other error code on failure:
> > + * - -EEXIST - section has been present.
> > + * - -ENOMEM - out of memory.
>
> I am not really into kernel-doc format, but I thought it was something like:
>
> <--
> Return:
> 0: success
> -EEXIST: Section is already present
> -ENOMEM: Out of memory
> -->
>
> But as I said, I might very well be wrong.
Below is excerpt from doc-guide/kernel-doc.rst. Seems they suggest it
like this if format returned values with multi-line style. While the
format is not strictly defined. I will use it to update.
*Return:
* * 0 - Success
* * -EEXIST - Section is already present
* * -ENOMEM - Out of memory
The return value, if any, should be described in a dedicated section
named ``Return``.
.. note::
#) The multi-line descriptive text you provide does *not* recognize
line breaks, so if you try to format some text nicely, as in::
* Return:
* 0 - OK
* -EINVAL - invalid argument
* -ENOMEM - out of memory
this will all run together and produce::
Return: 0 - OK -EINVAL - invalid argument -ENOMEM - out of memory
So, in order to produce the desired line breaks, you need to use a
ReST list, e. g.::
* Return:
* * 0 - OK to runtime suspend the device
* * -EBUSY - Device should not be runtime suspended
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment
2019-03-29 8:29 [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment Baoquan He
` (2 preceding siblings ...)
2019-03-29 10:36 ` Oscar Salvador
@ 2019-03-29 10:40 ` Mukesh Ojha
2019-03-30 9:50 ` Mike Rapoport
4 siblings, 0 replies; 14+ messages in thread
From: Mukesh Ojha @ 2019-03-29 10:40 UTC (permalink / raw)
To: Baoquan He, linux-kernel
Cc: linux-mm, rafael, akpm, mhocko, osalvador, rppt, willy, fanc.fnst
On 3/29/2019 1:59 PM, Baoquan He wrote:
> The code comment above sparse_add_one_section() is obsolete and
> incorrect, clean it up and write new one.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Cheers,
-Mukesh
> ---
> v2->v3:
> Normalize the code comment to use '/**' at 1st line of doc
> above function.
> v1-v2:
> Add comments to explain what the returned value means for
> each error code.
> mm/sparse.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 69904aa6165b..363f9d31b511 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -684,10 +684,19 @@ static void free_map_bootmem(struct page *memmap)
> #endif /* CONFIG_MEMORY_HOTREMOVE */
> #endif /* CONFIG_SPARSEMEM_VMEMMAP */
>
> -/*
> - * returns the number of sections whose mem_maps were properly
> - * set. If this is <=0, then that means that the passed-in
> - * map was not consumed and must be freed.
> +/**
> + * sparse_add_one_section - add a memory section
> + * @nid: The node to add section on
> + * @start_pfn: start pfn of the memory range
> + * @altmap: device page map
> + *
> + * This is only intended for hotplug.
> + *
> + * Returns:
> + * 0 on success.
> + * Other error code on failure:
> + * - -EEXIST - section has been present.
> + * - -ENOMEM - out of memory.
> */
> int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,
> struct vmem_altmap *altmap)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment
2019-03-29 8:29 [PATCH v3 1/2] mm/sparse: Clean up the obsolete code comment Baoquan He
` (3 preceding siblings ...)
2019-03-29 10:40 ` Mukesh Ojha
@ 2019-03-30 9:50 ` Mike Rapoport
4 siblings, 0 replies; 14+ messages in thread
From: Mike Rapoport @ 2019-03-30 9:50 UTC (permalink / raw)
To: Baoquan He
Cc: linux-kernel, linux-mm, rafael, akpm, mhocko, osalvador, willy,
fanc.fnst
On Fri, Mar 29, 2019 at 04:29:14PM +0800, Baoquan He wrote:
> The code comment above sparse_add_one_section() is obsolete and
> incorrect, clean it up and write new one.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> v2->v3:
> Normalize the code comment to use '/**' at 1st line of doc
> above function.
> v1-v2:
> Add comments to explain what the returned value means for
> each error code.
> mm/sparse.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 69904aa6165b..363f9d31b511 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -684,10 +684,19 @@ static void free_map_bootmem(struct page *memmap)
> #endif /* CONFIG_MEMORY_HOTREMOVE */
> #endif /* CONFIG_SPARSEMEM_VMEMMAP */
>
> -/*
> - * returns the number of sections whose mem_maps were properly
> - * set. If this is <=0, then that means that the passed-in
> - * map was not consumed and must be freed.
> +/**
> + * sparse_add_one_section - add a memory section
> + * @nid: The node to add section on
> + * @start_pfn: start pfn of the memory range
> + * @altmap: device page map
> + *
> + * This is only intended for hotplug.
> + *
> + * Returns:
> + * 0 on success.
> + * Other error code on failure:
> + * - -EEXIST - section has been present.
> + * - -ENOMEM - out of memory.
> */
> int __meminit sparse_add_one_section(int nid, unsigned long start_pfn,
> struct vmem_altmap *altmap)
> --
> 2.17.2
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 14+ messages in thread