diff mbox series

[v2] MM: handle THP in swap_*page_fs() - count_vm_events()

Message ID 165146948934.24404.5909750610552745025@noble.neil.brown.name (mailing list archive)
State New, archived
Headers show
Series [v2] MM: handle THP in swap_*page_fs() - count_vm_events() | expand

Commit Message

NeilBrown May 2, 2022, 5:31 a.m. UTC
We need to use count_swpout_vm_event() for sio_write_complete() to get
correct counting.

Note that THP swap in (if it ever happens) is current accounted 1 for
each page, whether HUGE or normal.  This is different from swap-out
accounting.

This patch should be squashed into
    MM: handle THP in swap_*page_fs()

Reported-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
 mm/page_io.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Miaohe Lin May 9, 2022, 8:54 a.m. UTC | #1
On 2022/5/2 13:31, NeilBrown wrote:
> 
> We need to use count_swpout_vm_event() for sio_write_complete() to get
> correct counting.
> 
> Note that THP swap in (if it ever happens) is current accounted 1 for
> each page, whether HUGE or normal.  This is different from swap-out
> accounting.

Agree, there is no THP swap-in now.

> 
> This patch should be squashed into
>     MM: handle THP in swap_*page_fs()
> 

This patch looks good to me. Thanks!

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>

> Reported-by: Miaohe Lin <linmiaohe@huawei.com>
> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
>  mm/page_io.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/page_io.c b/mm/page_io.c
> index d636a3531cad..1b8075ef3418 100644
> --- a/mm/page_io.c
> +++ b/mm/page_io.c
> @@ -280,8 +280,10 @@ static void sio_write_complete(struct kiocb *iocb, long ret)
>  			set_page_dirty(page);
>  			ClearPageReclaim(page);
>  		}
> -	} else
> -		count_vm_events(PSWPOUT, sio->pages);
> +	} else {
> +		for (p = 0; p < sio->pages; p++)
> +			count_swpout_vm_event(sio->bvec[p].bv_page);
> +	}
>  
>  	for (p = 0; p < sio->pages; p++)
>  		end_page_writeback(sio->bvec[p].bv_page);
>
diff mbox series

Patch

diff --git a/mm/page_io.c b/mm/page_io.c
index d636a3531cad..1b8075ef3418 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -280,8 +280,10 @@  static void sio_write_complete(struct kiocb *iocb, long ret)
 			set_page_dirty(page);
 			ClearPageReclaim(page);
 		}
-	} else
-		count_vm_events(PSWPOUT, sio->pages);
+	} else {
+		for (p = 0; p < sio->pages; p++)
+			count_swpout_vm_event(sio->bvec[p].bv_page);
+	}
 
 	for (p = 0; p < sio->pages; p++)
 		end_page_writeback(sio->bvec[p].bv_page);