From: Nhat Pham <nphamcs@gmail.com>
To: Barry Song <21cnbao@gmail.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Barry Song <v-songbaohua@oppo.com>,
Usama Arif <usamaarif642@gmail.com>,
Chengming Zhou <chengming.zhou@linux.dev>,
Yosry Ahmed <yosryahmed@google.com>,
Johannes Weiner <hannes@cmpxchg.org>,
David Hildenbrand <david@redhat.com>,
Hugh Dickins <hughd@google.com>,
Matthew Wilcox <willy@infradead.org>,
Shakeel Butt <shakeel.butt@linux.dev>,
Andi Kleen <ak@linux.intel.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Chris Li <chrisl@kernel.org>,
"Huang, Ying" <ying.huang@intel.com>,
Kairui Song <kasong@tencent.com>,
Ryan Roberts <ryan.roberts@arm.com>
Subject: Re: [PATCH RFC] mm: count zeromap read and set for swapout and swapin
Date: Sat, 26 Oct 2024 19:45:42 -0700 [thread overview]
Message-ID: <CAKEwX=NFtcoiqiLa2ov-AR1coYnJE-gXVf32DihJcTYTOJcQdQ@mail.gmail.com> (raw)
In-Reply-To: <20241027011959.9226-1-21cnbao@gmail.com>
On Sat, Oct 26, 2024 at 6:20 PM Barry Song <21cnbao@gmail.com> wrote:
>
> From: Barry Song <v-songbaohua@oppo.com>
>
> When the proportion of folios from the zero map is small, missing their
> accounting may not significantly impact profiling. However, it’s easy
> to construct a scenario where this becomes an issue—for example,
> allocating 1 GB of memory, writing zeros from userspace, followed by
> MADV_PAGEOUT, and then swapping it back in. In this case, the swap-out
> and swap-in counts seem to vanish into a black hole, potentially
> causing semantic ambiguity.
I agree. It also makes developing around this area more challenging.
I'm working on the swap abstraction, and sometimes I can't tell if I
screwed up somewhere, or if a proportion of these allocated entries go
towards this optimization...
Thanks for taking a stab at fixing this, Barry!
>
> We have two ways to address this:
>
> 1. Add a separate counter specifically for the zero map.
> 2. Continue using the current accounting, treating the zero map like
> a normal backend. (This aligns with the current behavior of zRAM
> when supporting same-page fills at the device level.)
Hmm, my understanding of the pswpout/pswpin counters is that they only
apply to IO done directly to the backend device, no? That's why we
have a separate set of counters for zswap, and do not count them
towards pswp(in|out).
For users who have swap files on physical disks, the performance
difference between reading directly from the swapfile and going
through these optimizations could be really large. I think it makes
sense to have a separate set of counters for zero-mapped pages
(ideally, both at the host level and at the cgroup level?)
next prev parent reply other threads:[~2024-10-27 2:45 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-27 1:19 Barry Song
2024-10-27 2:45 ` Nhat Pham [this message]
2024-10-28 2:32 ` Barry Song
2024-10-28 12:23 ` Usama Arif
2024-10-28 16:33 ` Nhat Pham
2024-10-28 17:00 ` Usama Arif
2024-10-28 17:08 ` Yosry Ahmed
2024-10-28 17:19 ` Usama Arif
2024-10-28 19:54 ` Barry Song
2024-10-28 19:58 ` Yosry Ahmed
2024-10-28 20:00 ` Usama Arif
2024-10-28 20:42 ` Barry Song
2024-10-28 20:51 ` Usama Arif
2024-10-28 21:15 ` Barry Song
2024-10-28 21:24 ` Usama Arif
2024-10-28 21:40 ` Barry Song
2024-10-28 21:49 ` Usama Arif
2024-10-28 22:11 ` Barry Song
2024-10-28 22:32 ` Yosry Ahmed
2024-10-28 22:51 ` Barry Song
2024-10-28 22:54 ` Yosry Ahmed
2024-10-28 23:03 ` Barry Song
2024-10-29 17:46 ` Nhat Pham
2024-10-29 17:55 ` Yosry Ahmed
2024-10-30 23:46 ` Nhat Pham
2024-10-28 16:34 ` Nhat Pham
2024-10-28 17:17 ` David Hildenbrand
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='CAKEwX=NFtcoiqiLa2ov-AR1coYnJE-gXVf32DihJcTYTOJcQdQ@mail.gmail.com' \
--to=nphamcs@gmail.com \
--cc=21cnbao@gmail.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=chengming.zhou@linux.dev \
--cc=chrisl@kernel.org \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.com \
--cc=shakeel.butt@linux.dev \
--cc=usamaarif642@gmail.com \
--cc=v-songbaohua@oppo.com \
--cc=willy@infradead.org \
--cc=ying.huang@intel.com \
--cc=yosryahmed@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox