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: <CAMgjq7DjVu5q2w_GaA075YLAtkS0yMKOyTiuwhmEDZQZjBC4Uw@mail.gmail.com>
Date: Mon, 8 Sep 2025 23:01:53 +0800
From: Kairui Song <ryncsn@...il.com>
To: David Hildenbrand <david@...hat.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>, 
	Barry Song <baohua@...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>, 
	Yosry Ahmed <yosryahmed@...gle.com>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, 
	Zi Yan <ziy@...dia.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 07/15] mm, swap: tidy up swap device and cluster info helpers

On Mon, Sep 8, 2025 at 8:52 PM David Hildenbrand <david@...hat.com> wrote:
>
> On 05.09.25 21:13, Kairui Song wrote:
> > From: Kairui Song <kasong@...cent.com>
> >
> > swp_swap_info is the most commonly used helper for retrieving swap info.
> > It has an internal check that may lead to a NULL return value, but
> > almost none of its caller checks the return value, making the internal
> > check pointless. In fact, most of these callers already ensured the
> > entry is valid and never expect a NULL value.
> >
> > Tidy this up and shorten the name. If the caller can make sure the
>
> "Tidy this up and improve the function names." ?

Yeah you are right. Most names actually got longer :)

>
> > swap entry/type is valid and the device is pinned, use the new introduced
> > __swap_entry_to_info/__swap_type_to_info instead. They have more debug
> > sanity checks and lower overhead as they are inlined.
> >
> > Callers that may expect a NULL value should use
> > swap_entry_to_info/swap_type_to_info instead.
> >
> > No feature change. The rearranged codes should have had no effect, or
> > they should have been hitting NULL de-ref bugs already. Only some new
> > sanity checks are added so potential issues may show up in debug build.
> >
> > The new helpers will be frequently used with swap table later when working
> > with swap cache folios. A locked swap cache folio ensures the entries are
> > valid and stable so these helpers are very helpful.
> >
> > Signed-off-by: Kairui Song <kasong@...cent.com>
> > Acked-by: Chris Li <chrisl@...nel.org>
> > Reviewed-by: Barry Song <baohua@...nel.org>
> > ---
>
> Acked-by: David Hildenbrand <david@...hat.com>

Thanks!

>
> --
> Cheers
>
> David / dhildenb
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ