Re: [RFC] Storing same-filled pages without a zswap_entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 21, 2024 at 5:29 PM Chris Li <chrisl@xxxxxxxxxx> wrote:
>
> On Thu, Mar 21, 2024 at 12:58 PM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
> >
> > On Thu, Mar 21, 2024 at 12:29 PM Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
> > >
> > > On Thu, Mar 21, 2024 at 06:44:54PM +0000, Yosry Ahmed wrote:
> > > > > In some cases where the current objcg is not "correct", the testcases in
> > > > > test_zswap.c may break? Maybe we can use swap_cgroup info to charge the
> > > > > stats to the correct memcg? Not sure if this is feasible.
> > > >
> > > > For cgroup v1, swap_cgroup will be cleared from
> > > > mem_cgroup_swapin_uncharge_swap() before the zswap load.
> > > >
> > > > I think the current objcg will remain correct as long as swapin happens
> > > > from the same memcg as swapout (or if swapin happens from the parent
> > > > memcg and the swapout memcg was offlined).
> > >
> > > Swap readahead will pull in physically adjacent entries that may
> > > belong to somebody unrelated.
> >
> > Right. For those as well the current objcg would be correct if they
> > are readahead from the same memcg as the one they were swapped out
> > from, but I understand your point that readahead makes that more
> > likely to not be the case.
> >
> > I am slightly nervous about using the current objcg tbh, even though
> > it only affects the stats. It's just less straightforward this way. I
> > think I prefer either:
> > (a) Only supporting zero-filled pages and storing the objcg directly
> > in the xarray.
>
> We can add the zero-filled page as a special case to speed it up. I
> don't think we should remove non zero values of the same fill pages
> from zswap though. We can never declare the non zero same filled page
> is not going to happen. In that case, the current same fill is still
> better than going through the zsmalloc.

If we do this, we still need to support same-filled entries in
zswap_entry, which means we still cannot separate the logic
completely. Also, it would be weird to have zero-filled pages and
same-filled pages handled differently.

How common do we think same-filled but not zero-filled pages are? Are
there known user space usages or patterns that lead to this? The only
thing I can think of is if user space initializes a large array to the
same non-zero value, and then it gets swapped out before it is
modified.

If it is not common, perhaps it's not worth optimizing it.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux