From: Minchan Kim <minchan@kernel.org>
To: Alexey Romanov <AVRomanov@sberdevices.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm <linux-mm@kvack.org>, Jens Axboe <axboe@kernel.dk>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Seth Jennings <sjenning@redhat.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH 2/3] zram: support frontswap
Date: Tue, 11 Jul 2023 16:58:33 -0700 [thread overview]
Message-ID: <ZK3sqcfdC3NUajYH@google.com> (raw)
In-Reply-To: <20230711100848.ctymfhdy6bp3lin5@cab-wsm-0029881.sigma.sbrf.ru>
On Tue, Jul 11, 2023 at 10:08:46AM +0000, Alexey Romanov wrote:
> Hello,
>
> On Mon, Jul 10, 2023 at 03:16:58PM -0700, Minchan Kim wrote:
> > With frontswap, zram can perform swapout 13% faster, which restores
> > its original performance with rw_page.
> >
> > 200M swapout using MADV_PAGEOUT:
> > Before: 4355ms After: 3786ms
> >
> > Signed-off-by: Minchan Kim <minchan@kernel.org>
> > ---
> > drivers/block/zram/Kconfig | 1 +
> > drivers/block/zram/zram_drv.c | 98 +++++++++++++++++++++++++++++++++++
> > drivers/block/zram/zram_drv.h | 1 +
> > 3 files changed, 100 insertions(+)
> >
> > diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig
> > index 0386b7da02aa..a841d6d14c74 100644
> > --- a/drivers/block/zram/Kconfig
> > +++ b/drivers/block/zram/Kconfig
> > @@ -4,6 +4,7 @@ config ZRAM
> > depends on BLOCK && SYSFS && MMU
> > depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842
> > select ZSMALLOC
> > + select FRONTSWAP
> > help
> > Creates virtual block devices called /dev/zramX (X = 0, 1, ...).
> > Pages written to these disks are compressed and stored in memory
> > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> > index 5d258a28ec43..5e973c982235 100644
> > --- a/drivers/block/zram/zram_drv.c
> > +++ b/drivers/block/zram/zram_drv.c
> > @@ -33,6 +33,8 @@
> > #include <linux/debugfs.h>
> > #include <linux/cpuhotplug.h>
> > #include <linux/part_stat.h>
> > +#include <linux/swap.h>
> > +#include <linux/frontswap.h>
> >
> > #include "zram_drv.h"
> >
> > @@ -2170,6 +2172,90 @@ static struct attribute *zram_disk_attrs[] = {
> >
> > ATTRIBUTE_GROUPS(zram_disk);
> >
> > +static struct zram *zram_swaps[MAX_SWAPFILES];
> > +static LIST_HEAD(zram_list);
> > +static DEFINE_SPINLOCK(zram_list_lock);
> > +
> > +static int zram_frontswap_store(unsigned int type, pgoff_t index,
> > + struct page *page)
> > +{
> > + int err;
> > + struct zram *zram = zram_swaps[type];
> > +
> > + err = zram_write_page(zram, page, index);
> > + if (!err) {
> > + zram_slot_lock(zram, index);
> > + zram_accessed(zram, index);
> > + zram_slot_unlock(zram, index);
> > + }
> > +
> > + return err;
> > +}
> > +
> > +static int zram_frontswap_load(unsigned int type, pgoff_t index,
> > + struct page *page, bool *exclusive)
> > +{
> > + int err;
> > + struct zram *zram = zram_swaps[type];
> > +
> > + zram_slot_lock(zram, index);
> > + if (zram_test_flag(zram, index, ZRAM_WB)) {
> > + zram_slot_lock(zram, index);
>
> Looks like zram_slot_unlock should be here instead of zram_slot_lock.
me/ slabs self.
>
> > + return -1;
> > + }
> > +
> > + err = zram_read_from_zspool(zram, page, index);
> > + if (!err)
> > + zram_accessed(zram, index);
> > + zram_slot_unlock(zram, index);
> > +
> > + return err;
> > +}
> > +
> > +static void zram_frontswap_invalidate_area(unsigned int type)
> > +{
> > + struct zram *zram = zram_swaps[type];
> > +
> > + if (!zram)
> > + return;
> > +}
>
> It makes sense? Maybe we just leave this function empty?
Sorry, it was wrong version from my git tree.
I had destroy zram in the case originally
but since I decide to drop this patchset, never mind.
Thanks for spending time for review, Alexey.
next prev parent reply other threads:[~2023-07-11 23:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-10 22:16 [PATCH 0/3] zram: use frontswap for zram swap usecase Minchan Kim
2023-07-10 22:16 ` [PATCH 1/3] frontswap: support backing_dev Minchan Kim
2023-07-10 22:16 ` [PATCH 2/3] zram: support frontswap Minchan Kim
2023-07-11 10:08 ` Alexey Romanov
2023-07-11 23:58 ` Minchan Kim [this message]
2023-07-10 22:16 ` [PATCH 3/3] zram: remove swap_slot_free_notify Minchan Kim
2023-07-11 10:09 ` Alexey Romanov
2023-07-11 5:17 ` [PATCH 0/3] zram: use frontswap for zram swap usecase Christoph Hellwig
2023-07-11 17:52 ` Nhat Pham
2023-07-11 23:56 ` Minchan Kim
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=ZK3sqcfdC3NUajYH@google.com \
--to=minchan@kernel.org \
--cc=AVRomanov@sberdevices.ru \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=konrad.wilk@oracle.com \
--cc=linux-mm@kvack.org \
--cc=senozhatsky@chromium.org \
--cc=sjenning@redhat.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.