diff mbox series

[14/15] mm/swap: fix the comment of get_kernel_pages

Message ID 20220509131416.17553-15-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series A few cleanup patches for swap | expand

Commit Message

Miaohe Lin May 9, 2022, 1:14 p.m. UTC
If no pages were pinned, 0 is returned in fact. Fix the corresponding
comment.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/swap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Hildenbrand May 12, 2022, 1:45 p.m. UTC | #1
On 09.05.22 15:14, Miaohe Lin wrote:
> If no pages were pinned, 0 is returned in fact. Fix the corresponding
> comment.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/swap.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/swap.c b/mm/swap.c
> index 6d2c37f781f8..236b37663a1a 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -168,8 +168,8 @@ EXPORT_SYMBOL(put_pages_list);
>   *
>   * Returns number of pages pinned. This may be fewer than the number
>   * requested. If nr_pages is 0 or negative, returns 0. If no pages

Ehm, there is only "nr_segs", no "nr_pages" :/ Want to fix that up in
the same patch?

> - * were pinned, returns -errno. Each page returned must be released
> - * with a put_page() call when it is finished with.
> + * were pinned, returns 0. Each page returned must be released with
> + * a put_page() call when it is finished with.
>   */
>  int get_kernel_pages(const struct kvec *kiov, int nr_segs, int write,
>  		struct page **pages)

Apart from that

Reviewed-by: David Hildenbrand <david@redhat.com>
Miaohe Lin May 13, 2022, 6:15 a.m. UTC | #2
On 2022/5/12 21:45, David Hildenbrand wrote:
> On 09.05.22 15:14, Miaohe Lin wrote:
>> If no pages were pinned, 0 is returned in fact. Fix the corresponding
>> comment.
>>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>>  mm/swap.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/swap.c b/mm/swap.c
>> index 6d2c37f781f8..236b37663a1a 100644
>> --- a/mm/swap.c
>> +++ b/mm/swap.c
>> @@ -168,8 +168,8 @@ EXPORT_SYMBOL(put_pages_list);
>>   *
>>   * Returns number of pages pinned. This may be fewer than the number
>>   * requested. If nr_pages is 0 or negative, returns 0. If no pages
> 
> Ehm, there is only "nr_segs", no "nr_pages" :/ Want to fix that up in
> the same patch?

Will do.

> 
>> - * were pinned, returns -errno. Each page returned must be released
>> - * with a put_page() call when it is finished with.
>> + * were pinned, returns 0. Each page returned must be released with
>> + * a put_page() call when it is finished with.
>>   */
>>  int get_kernel_pages(const struct kvec *kiov, int nr_segs, int write,
>>  		struct page **pages)
> 
> Apart from that
> 
> Reviewed-by: David Hildenbrand <david@redhat.com>

Many thanks for review and comment!

>
Andrew Morton May 17, 2022, 11:39 p.m. UTC | #3
On Fri, 13 May 2022 14:15:38 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:

> On 2022/5/12 21:45, David Hildenbrand wrote:
> > On 09.05.22 15:14, Miaohe Lin wrote:
> >> If no pages were pinned, 0 is returned in fact. Fix the corresponding
> >> comment.
> >>
> >> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> >> ---
> >>  mm/swap.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/mm/swap.c b/mm/swap.c
> >> index 6d2c37f781f8..236b37663a1a 100644
> >> --- a/mm/swap.c
> >> +++ b/mm/swap.c
> >> @@ -168,8 +168,8 @@ EXPORT_SYMBOL(put_pages_list);
> >>   *
> >>   * Returns number of pages pinned. This may be fewer than the number
> >>   * requested. If nr_pages is 0 or negative, returns 0. If no pages
> > 
> > Ehm, there is only "nr_segs", no "nr_pages" :/ Want to fix that up in
> > the same patch?
> 
> Will do.

I also reflowed that comment to use more columns.

--- a/mm/swap.c~mm-swap-fix-the-comment-of-get_kernel_pages-fix
+++ a/mm/swap.c
@@ -166,10 +166,10 @@ EXPORT_SYMBOL(put_pages_list);
  * @pages:	array that receives pointers to the pages pinned.
  *		Should be at least nr_segs long.
  *
- * Returns number of pages pinned. This may be fewer than the number
- * requested. If nr_pages is 0 or negative, returns 0. If no pages
- * were pinned, returns 0. Each page returned must be released with
- * a put_page() call when it is finished with.
+ * Returns number of pages pinned. This may be fewer than the number requested.
+ * If nr_segs is 0 or negative, returns 0.  If no pages were pinned, returns 0.
+ * Each page returned must be released with a put_page() call when it is
+ * finished with.
  */
 int get_kernel_pages(const struct kvec *kiov, int nr_segs, int write,
 		struct page **pages)
diff mbox series

Patch

diff --git a/mm/swap.c b/mm/swap.c
index 6d2c37f781f8..236b37663a1a 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -168,8 +168,8 @@  EXPORT_SYMBOL(put_pages_list);
  *
  * Returns number of pages pinned. This may be fewer than the number
  * requested. If nr_pages is 0 or negative, returns 0. If no pages
- * were pinned, returns -errno. Each page returned must be released
- * with a put_page() call when it is finished with.
+ * were pinned, returns 0. Each page returned must be released with
+ * a put_page() call when it is finished with.
  */
 int get_kernel_pages(const struct kvec *kiov, int nr_segs, int write,
 		struct page **pages)