Re: [RFC PATCH v3 04/21] mm/zsmalloc: add alternatives of frequently used helper functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 4, 2023 at 12:45 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Thu, Nov 30, 2023 at 07:12:25PM +0900, Hyeonggon Yoo wrote:
> > +static __maybe_unused int is_first_zsdesc(struct zsdesc *zsdesc)
> > +{
> > +     return PagePrivate(zsdesc_page(zsdesc));
> > +}
>
> static inline bool is_first_zsdesc(struct zsdesc *zsdesc)
> {
>         return folio_test_private(zsdesc_folio(zsdesc));
> }

PagePrivate(zsdesc_page(zsdesc)) is fine as zsmalloc always allocates
a base page,
and then build a chain of base pages. That's not going to change anytime soon.
But will drop __maybe_unused and add inline.

> > -static inline struct page *get_first_page(struct zspage *zspage)
> > +static __maybe_unused inline struct page *get_first_page(struct zspage *zspage)
>
> I don't think you need __maybe_unused with inline.

Right, will adjust in v4.

> > +static __maybe_unused struct zsdesc *get_first_zsdesc(struct zspage *zspage)
> > +{
> > +     struct zsdesc *first_zsdesc = zspage->first_zsdesc;
> > +
> > +     VM_BUG_ON_PAGE(!is_first_zsdesc(first_zsdesc), zsdesc_page(first_zsdesc));
>
> Do we want a VM_BUG_ON_ZSDESC?

If the kernel starts allocating zsdesc separately, we'll need that.
But at now, I don't think we need to implement that yet?

Thanks!
--
Hyeonggon





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux