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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMgjq7AJ1=ji4iw03JmdN07MpY8V0CFdtUHpF58mTnSjGf=rGA@mail.gmail.com>
Date: Wed, 17 Sep 2025 11:52:28 +0800
From: Kairui Song <ryncsn@...il.com>
To: Barry Song <21cnbao@...il.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>, 
	Matthew Wilcox <willy@...radead.org>, Hugh Dickins <hughd@...gle.com>, Chris Li <chrisl@...nel.org>, 
	Baoquan He <bhe@...hat.com>, Nhat Pham <nphamcs@...il.com>, 
	Kemeng Shi <shikemeng@...weicloud.com>, Baolin Wang <baolin.wang@...ux.alibaba.com>, 
	Ying Huang <ying.huang@...ux.alibaba.com>, Johannes Weiner <hannes@...xchg.org>, 
	David Hildenbrand <david@...hat.com>, Yosry Ahmed <yosryahmed@...gle.com>, 
	Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Zi Yan <ziy@...dia.com>, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 15/15] mm, swap: use a single page for swap table when
 the size fits

On Wed, Sep 17, 2025 at 6:31 AM Barry Song <21cnbao@...il.com> wrote:
>
> On Wed, Sep 17, 2025 at 12:02 AM Kairui Song <ryncsn@...il.com> wrote:
> >
> > From: Kairui Song <kasong@...cent.com>
> >
> > We have a cluster size of 512 slots. Each slot consumes 8 bytes in swap
> > table so the swap table size of each cluster is exactly one page (4K).
> >
> > If that condition is true, allocate one page direct and disable the slab
> > cache to reduce the memory usage of swap table and avoid fragmentation.
> >
> > Co-developed-by: Chris Li <chrisl@...nel.org>
> > Signed-off-by: Chris Li <chrisl@...nel.org>
> > Signed-off-by: Kairui Song <kasong@...cent.com>
> > Acked-by: Chris Li <chrisl@...nel.org>
>
> looks good to me, with just a minor nit noted below.
>
> Reviewed-by: Barry Song <baohua@...nel.org>

Thanks

>
> > ---
> > +static void swap_table_free(struct swap_table *table)
> > +{
> > +       if (!SWP_TABLE_USE_PAGE) {
> > +               kmem_cache_free(swap_table_cachep, table);
> > +               return;
> > +       }
> > +
> > +       call_rcu(&(folio_page(virt_to_folio(table), 0)->rcu_head),
> > +                swap_table_free_folio_rcu_cb);
> > +}
>
> Can’t it simply be:
> virt_to_page(table)->rcu_head ?

I'm not sure if we prefer folios when possible?

Either way is fine, they are identical for this use case.

> Thanks
> Barry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ