All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <baoquan.he@linux.dev>
To: Christoph Hellwig <hch@lst.de>
Cc: akpm@linux-foundation.org, chrisl@kernel.org,
	usama.arif@linux.dev, kasong@tencent.com, nphamcs@gmail.com,
	shikemeng@huaweicloud.com, youngjun.park@lge.com,
	linux-mm@kvack.org
Subject: Re: [PATCH 8/8] mm/vmstat: add NRSWP{IN,OUT} counters
Date: Fri, 5 Jun 2026 15:16:21 +0800	[thread overview]
Message-ID: <aiJ3xfFxcS62MOK9@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20260601113449.3464734-9-hch@lst.de>

On 06/01/26 at 01:34pm, Christoph Hellwig wrote:
> Count how many swap I/Os we cause.  Due to batching this can be
> different than the currently counter number of pages written/read,
                     ~~~~~~~ current, typo?
> and tracking this information is useful to see how efficient the
> batching is.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  include/linux/vm_event_item.h | 4 ++++
>  mm/page_io.c                  | 2 ++
>  mm/vmstat.c                   | 6 +++++-
>  3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
> index 03fe95f5a020..2628ccda076a 100644
> --- a/include/linux/vm_event_item.h
> +++ b/include/linux/vm_event_item.h
> @@ -175,6 +175,10 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
>  		KSTACK_REST,
>  #endif
>  #endif /* CONFIG_DEBUG_STACK_USAGE */
> +#ifdef CONFIG_SWAP
> +		NRSWPIN,
> +		NRSWPOUT,
> +#endif /* CONFIG_SWAP */

Putting them together with 'SWAP_RA ... SWPOUT_ZERO' could impact the
ongoing program/script?

>  		NR_VM_EVENT_ITEMS
>  };
>  
> diff --git a/mm/page_io.c b/mm/page_io.c
> index cdac55d0a2e9..c020e8ebf966 100644
> --- a/mm/page_io.c
> +++ b/mm/page_io.c
> @@ -695,6 +695,7 @@ void swap_write_submit(struct swap_io_ctx *ctx)
>  {
>  	if (!ctx->sio)
>  		return;
> +	count_vm_events(NRSWPOUT, 1);
>  	ctx->sis->ops->submit_write(ctx);
>  	ctx->sio = NULL;
>  	ctx->sis = NULL;
> @@ -704,6 +705,7 @@ void swap_read_submit(struct swap_io_ctx *ctx)
>  {
>  	if (!ctx->sio)
>  		return;
> +	count_vm_events(NRSWPIN, 1);
>  	ctx->sis->ops->submit_read(ctx);
>  	ctx->sio = NULL;
>  	ctx->sis = NULL;
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index f534972f517d..9559f3c95735 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1488,7 +1488,11 @@ const char * const vmstat_text[] = {
>  #if THREAD_SIZE > 65536
>  	[I(KSTACK_REST)]			= "kstack_rest",
>  #endif
> -#endif
> +#endif /* CONFIG_DEBUG_STACK_USAGE */
> +#ifdef CONFIG_SWAP
> +	[I(NRSWPIN)]				= "nrswpin",
> +	[I(NRSWPOUT)]				= "nrswpout",
> +#endif /* CONFIG_SWAP */
>  #undef I
>  #endif /* CONFIG_VM_EVENT_COUNTERS */
>  };
> -- 
> 2.53.0
> 


  reply	other threads:[~2026-06-05  7:16 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01 11:34 better block swap batching and a different take on swap_ops v2 Christoph Hellwig
2026-06-01 11:34 ` [PATCH 1/8] shmem: provide a shmem_write_folio wrapper Christoph Hellwig
2026-06-04  9:43   ` Baoquan He
2026-06-05 17:07   ` Nhat Pham
2026-06-01 11:34 ` [PATCH 2/8] mm: merge writeout into pageout Christoph Hellwig
2026-06-04  9:44   ` Baoquan He
2026-06-05 17:07   ` Nhat Pham
2026-06-01 11:34 ` [PATCH 3/8] mm/swap: introduce struct swap_io_ctx Christoph Hellwig
2026-06-04 10:58   ` Baoquan He
2026-06-05 17:41   ` Nhat Pham
2026-06-01 11:34 ` [PATCH 4/8] mm/swap: also use struct swap_iocb for block I/O Christoph Hellwig
2026-06-04 10:59   ` Baoquan He
2026-06-04 11:37   ` Baoquan He
2026-06-01 11:34 ` [PATCH 5/8] mm/swap: remove count_swpout_vm_event Christoph Hellwig
2026-06-04 11:37   ` Baoquan He
2026-06-05 17:50   ` Nhat Pham
2026-06-01 11:34 ` [PATCH 6/8] mm/swap: use swap_ops to register swap device's methods Christoph Hellwig
2026-06-05 17:53   ` Nhat Pham
2026-06-01 11:34 ` [PATCH 7/8] mm/swap: remove SWP_FS_OPS Christoph Hellwig
2026-06-05  5:21   ` Baoquan He
2026-06-05 17:58   ` Nhat Pham
2026-06-01 11:34 ` [PATCH 8/8] mm/vmstat: add NRSWP{IN,OUT} counters Christoph Hellwig
2026-06-05  7:16   ` Baoquan He [this message]
2026-06-05 17:48   ` Nhat Pham
2026-06-01 13:29 ` better block swap batching and a different take on swap_ops v2 Baoquan He
2026-06-01 14:50   ` Christoph Hellwig
2026-06-01 15:17     ` Baoquan He
2026-06-01 15:25       ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aiJ3xfFxcS62MOK9@MiWiFi-R3L-srv \
    --to=baoquan.he@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=chrisl@kernel.org \
    --cc=hch@lst.de \
    --cc=kasong@tencent.com \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=usama.arif@linux.dev \
    --cc=youngjun.park@lge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.