From: Yosry Ahmed <yosryahmed@google.com>
To: Barry Song <21cnbao@gmail.com>
Cc: Usama Arif <usamaarif642@gmail.com>,
Nhat Pham <nphamcs@gmail.com>,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Barry Song <v-songbaohua@oppo.com>,
Chengming Zhou <chengming.zhou@linux.dev>,
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>,
joshua.hahnjy@gmail.com
Subject: Re: [PATCH RFC] mm: count zeromap read and set for swapout and swapin
Date: Mon, 28 Oct 2024 12:58:47 -0700 [thread overview]
Message-ID: <CAJD7tkYUAeEYiX0OLTUPh7x23aT82sUrits0US47Phjioa-tKQ@mail.gmail.com> (raw)
In-Reply-To: <CAGsJ_4zQmaGxG2Ega61Jm5UMgHH-jtYC4ZCxsRX6+QS9ta25kQ@mail.gmail.com>
On Mon, Oct 28, 2024 at 12:54 PM Barry Song <21cnbao@gmail.com> wrote:
>
> On Tue, Oct 29, 2024 at 1:20 AM Usama Arif <usamaarif642@gmail.com> wrote:
> >
> >
> >
> > On 28/10/2024 17:08, Yosry Ahmed wrote:
> > > On Mon, Oct 28, 2024 at 10:00 AM Usama Arif <usamaarif642@gmail.com> wrote:
> > >>
> > >>
> > >>
> > >> On 28/10/2024 16:33, Nhat Pham wrote:
> > >>> On Mon, Oct 28, 2024 at 5:23 AM Usama Arif <usamaarif642@gmail.com> wrote:
> > >>>>
> > >>>> I wonder if instead of having counters, it might be better to keep track
> > >>>> of the number of zeropages currently stored in zeromap, similar to how
> > >>>> zswap_same_filled_pages did it. It will be more complicated then this
> > >>>> patch, but would give more insight of the current state of the system.
> > >>>>
> > >>>> Joshua (in CC) was going to have a look at that.
> > >>>
> > >>> I don't think one can substitute for the other.
> > >>
> > >> Yes agreed, they have separate uses and provide different information, but
> > >> maybe wasteful to have both types of counters? They are counters so maybe
> > >> dont consume too much resources but I think we should still think about
> > >> it..
> > >
> > > Not for or against here, but I would say that statement is debatable
> > > at best for memcg stats :)
> > >
> > > Each new counter consumes 2 longs per-memcg per-CPU (see
> > > memcg_vmstats_percpu), about 16 bytes, which is not a lot but it can
> > > quickly add up with a large number of CPUs/memcgs/stats.
> > >
> > > Also, when flushing the stats we iterate all of them to propagate
> > > updates from per-CPU counters. This is already a slowpath so adding
> > > one stat is not a big deal, but again because we iterate all stats on
> > > multiple CPUs (and sometimes on each node as well), the overall flush
> > > latency becomes a concern sometimes.
> > >
> > > All of that is not to say we shouldn't add more memcg stats, but we
> > > have to be mindful of the resources.
> >
> > Yes agreed! Plus the cost of incrementing similar counters (which ofcourse is
> > also not much).
> >
> > Not trying to block this patch in anyway. Just think its a good point
> > to discuss here if we are ok with both types of counters. If its too wasteful
> > then which one we should have.
>
> Hi Usama,
> my point is that with all the below three counters:
> 1. PSWPIN/PSWPOUT
> 2. ZSWPIN/ZSWPOUT
> 3. SWAPIN_SKIP/SWAPOUT_SKIP or (ZEROSWPIN, ZEROSWPOUT what ever)
>
> Shouldn't we have been able to determine the portion of zeromap
> swap indirectly?
What about swap entries that get freed without being swapped in (e.g.
swapped out anon memory freed, MADV_FREE, shmem truncate, etc)?
>
> Thanks
> Barry
next prev parent reply other threads:[~2024-10-28 19:59 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
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 [this message]
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=CAJD7tkYUAeEYiX0OLTUPh7x23aT82sUrits0US47Phjioa-tKQ@mail.gmail.com \
--to=yosryahmed@google.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=joshua.hahnjy@gmail.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--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 \
/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