lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJD7tkY6rxiB1oR+ykWFqx6JV=xsM-maPtu1rtthJZY_z1h5MQ@mail.gmail.com>
Date: Fri, 14 Jun 2024 11:41:21 -0700
From: Yosry Ahmed <yosryahmed@...gle.com>
To: Chengming Zhou <chengming.zhou@...ux.dev>
Cc: Usama Arif <usamaarif642@...il.com>, akpm@...ux-foundation.org, hannes@...xchg.org, 
	shakeel.butt@...ux.dev, david@...hat.com, ying.huang@...el.com, 
	hughd@...gle.com, willy@...radead.org, nphamcs@...il.com, linux-mm@...ck.org, 
	linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH v5 1/2] mm: store zero pages to be swapped out in a bitmap

On Fri, Jun 14, 2024 at 5:06 AM Chengming Zhou <chengming.zhou@...ux.dev> wrote:
>
> On 2024/6/14 18:07, Usama Arif wrote:
> > Approximately 10-20% of pages to be swapped out are zero pages [1].
> > Rather than reading/writing these pages to flash resulting
> > in increased I/O and flash wear, a bitmap can be used to mark these
> > pages as zero at write time, and the pages can be filled at
> > read time if the bit corresponding to the page is set.
> > With this patch, NVMe writes in Meta server fleet decreased
> > by almost 10% with conventional swap setup (zswap disabled).
> >
> > [1] https://lore.kernel.org/all/20171018104832epcms5p1b2232e2236258de3d03d1344dde9fce0@epcms5p1/
> >
> > Signed-off-by: Usama Arif <usamaarif642@...il.com>
>
> Looks good to me, only some small nits below.
>
> Reviewed-by: Chengming Zhou <chengming.zhou@...ux.dev>
>
> > ---
> >  include/linux/swap.h |   1 +
> >  mm/page_io.c         | 113 ++++++++++++++++++++++++++++++++++++++++++-
> >  mm/swapfile.c        |  15 ++++++
> >  3 files changed, 128 insertions(+), 1 deletion(-)
> >
> [...]
> > +
> > +static void swap_zeromap_folio_set(struct folio *folio)
> > +{
> > +     struct swap_info_struct *sis = swp_swap_info(folio->swap);
> > +     swp_entry_t entry;
> > +     unsigned int i;
> > +
> > +     for (i = 0; i < folio_nr_pages(folio); i++) {
> > +             entry = page_swap_entry(folio_page(folio, i));
>
> It seems simpler to use:
>
> swp_entry_t entry = folio->swap;
>
> for (i = 0; i < folio_nr_pages(folio); i++, entry.val++)

I was actually thinking we could introduce folio_swap_entry(folio, i)
after the series. Multiple callers of page_swap_entry() have a folio
already. It would save some compound_head() calls.

Alternatively, for this patch we can introduce
zeromap_update_range(zeromap, offset, size, value). Then we can use it
in swap_zeromap_folio_set/cear() as well as swap_range_free(). It
would also be a good place to park the comment about using atomic
operations (set_bit() and clear_bit()).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ