linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: Usama Arif <usamaarif642@gmail.com>
Cc: akpm@linux-foundation.org, axboe@kernel.dk, chrisl@kernel.org,
	 corbet@lwn.net, david@redhat.com, kanchana.p.sridhar@intel.com,
	 kasong@tencent.com, linux-block@vger.kernel.org,
	linux-mm@kvack.org,  minchan@kernel.org, nphamcs@gmail.com,
	senozhatsky@chromium.org,  surenb@google.com, terrelln@fb.com,
	v-songbaohua@oppo.com,  wajdi.k.feghali@intel.com,
	willy@infradead.org, ying.huang@intel.com,
	 yosryahmed@google.com, yuzhao@google.com,
	zhengtangquan@oppo.com,  zhouchengming@bytedance.com,
	bala.seshasayee@linux.intel.com,
	 Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH RFC 2/2] zram: support compression at the granularity of multi-pages
Date: Thu, 7 Nov 2024 23:25:18 +1300	[thread overview]
Message-ID: <CAGsJ_4w0f_eqHvmAr59FRNCsydjc2EQu4eHhSGFvurJn=TuvJA@mail.gmail.com> (raw)
In-Reply-To: <eabf4f2c-4192-42d5-b6cc-f36a3c7ad0f2@gmail.com>

On Thu, Nov 7, 2024 at 5:23 AM Usama Arif <usamaarif642@gmail.com> wrote:
>
>
>
> On 22/10/2024 00:28, Barry Song wrote:
> >> From: Tangquan Zheng <zhengtangquan@oppo.com>
> >>
> >> +static int zram_bvec_write_multi_pages(struct zram *zram, struct bio_vec *bvec,
> >> +                       u32 index, int offset, struct bio *bio)
> >> +{
> >> +    if (is_multi_pages_partial_io(bvec))
> >> +            return zram_bvec_write_multi_pages_partial(zram, bvec, index, offset, bio);
> >> +    return zram_write_page(zram, bvec->bv_page, index);
> >> +}
> >> +
>
> Hi Barry,
>
> I started reviewing this series just to get a better idea if we can do something
> similar for zswap. I haven't looked at zram code before so this might be a basic
> question:
> How would you end up in zram_bvec_write_multi_pages_partial if using zram for swap?

Hi Usama,

There’s a corner case where, for instance, a 32KiB mTHP is swapped
out. Then, if userspace
performs a MADV_DONTNEED on the 0~16KiB portion of this original mTHP,
it now consists
of 8 swap entries(mTHP has been released and unmapped). With
swap0-swap3 released
due to DONTNEED, they become available for reallocation, and other
folios may be swapped
out to those entries. Then it is a combination of the new smaller
folios with the original 32KiB
mTHP.

>
> We only swapout whole folios. If ZCOMP_MULTI_PAGES_SIZE=64K, any folio smaller
> than 64K will end up in zram_bio_write_page. Folios greater than or equal to 64K
> would be dispatched by zram_bio_write_multi_pages to zram_bvec_write_multi_pages
> in 64K chunks. So for e.g. 128K folio would end up calling zram_bvec_write_multi_pages
> twice.

In v2, I changed the default order to 2, allowing all anonymous mTHP
to benefit from this
feature.

>
> Or is this for the case when you are using zram not for swap? In that case, I probably
> dont need to consider zram_bvec_write_multi_pages_partial write case for zswap.
>
> Thanks,
> Usama

Thanks
barry


  reply	other threads:[~2024-11-07 10:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 21:48 [PATCH RFC 0/2] mTHP-friendly compression in zsmalloc and zram based on multi-pages Barry Song
2024-03-27 21:48 ` [PATCH RFC 1/2] mm: zsmalloc: support objects compressed based on multiple pages Barry Song
2024-10-21 23:26   ` Barry Song
2024-03-27 21:48 ` [PATCH RFC 2/2] zram: support compression at the granularity of multi-pages Barry Song
2024-04-11  0:40   ` Sergey Senozhatsky
2024-04-11  1:24     ` Barry Song
2024-04-11  1:42   ` Sergey Senozhatsky
2024-04-11  2:03     ` Barry Song
2024-04-11  4:14       ` Sergey Senozhatsky
2024-04-11  7:49         ` Barry Song
2024-04-19  3:41           ` Sergey Senozhatsky
2024-10-21 23:28   ` Barry Song
2024-11-06 16:23     ` Usama Arif
2024-11-07 10:25       ` Barry Song [this message]
2024-11-07 10:31         ` Barry Song
2024-11-07 11:49           ` Usama Arif
2024-11-07 20:53             ` Barry Song
2024-03-27 22:01 ` [PATCH RFC 0/2] mTHP-friendly compression in zsmalloc and zram based on multi-pages Barry Song

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='CAGsJ_4w0f_eqHvmAr59FRNCsydjc2EQu4eHhSGFvurJn=TuvJA@mail.gmail.com' \
    --to=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bala.seshasayee@linux.intel.com \
    --cc=chrisl@kernel.org \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=kanchana.p.sridhar@intel.com \
    --cc=kasong@tencent.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=surenb@google.com \
    --cc=terrelln@fb.com \
    --cc=usamaarif642@gmail.com \
    --cc=v-songbaohua@oppo.com \
    --cc=wajdi.k.feghali@intel.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=yosryahmed@google.com \
    --cc=yuzhao@google.com \
    --cc=zhengtangquan@oppo.com \
    --cc=zhouchengming@bytedance.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