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] [day] [month] [year] [list]
Message-ID: <CAGsJ_4xuV3SsJo0qN6HZxcJMAb2KX8UzZmrYkduLyKn46BrGQw@mail.gmail.com>
Date: Wed, 17 Sep 2025 12:50:42 +0800
From: Barry Song <21cnbao@...il.com>
To: Kairui Song <ryncsn@...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 12:41 PM Barry Song <21cnbao@...il.com> wrote:
>
> > >
> > > > ---
> > > > +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?
>
> Not sure either, but even Mathew still sometimes suggests using PAGE:
>
> https://lore.kernel.org/lkml/aLrrQDCBzaMwwmA-@casper.infradead.org/
>
> BTW, "(folio_page(folio), 0)" looks quite strange. I mean, why is it 0
> instead of 1?
> Although we know it’s always one PAGE, 0 still seems strange.

I mean, we should always free an entire folio, right?
It’s impossible to free just one page from a folio unless we split a THP, etc.

So it seems more correct that rcu_head should also be promoted to the folio.

/** @rcu_head: You can use this to free a folio by RCU. */
struct rcu_head rcu_head;

Definitely outside the scope of this patchset, so not a blocker :-)

>
> >
> > 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