[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66ad2ef0.170a0220.8fae7.6e38@mx.google.com>
Date: Fri, 2 Aug 2024 12:09:34 -0700
From: Vishal Moola <vishal.moola@...il.com>
To: alexs@...nel.org
Cc: Vitaly Wool <vitaly.wool@...sulko.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
minchan@...nel.org, willy@...radead.org, senozhatsky@...omium.org,
david@...hat.com, 42.hyeyoo@...il.com,
Yosry Ahmed <yosryahmed@...gle.com>, nphamcs@...il.com
Subject: Re: [PATCH v4 06/22] mm/zsmalloc: convert create_page_chain() and
its users to use zpdesc
On Mon, Jul 29, 2024 at 07:25:18PM +0800, alexs@...nel.org wrote:
> From: Alex Shi <alexs@...nel.org>
>
> Introduce a few helper functions for conversion to convert create_page_chain()
> to use zpdesc, then use zpdesc in replace_sub_page() too.
As a general note, I've been having trouble keeping track of your helper
functions throughout your patchset. Things get confusing when helper
functions are "add-ons" to patches and are then replaced/rewritten
in various subsequent patches - might just be me though.
> Originally-by: Hyeonggon Yoo <42.hyeyoo@...il.com>
> Signed-off-by: Alex Shi <alexs@...nel.org>
> ---
> mm/zpdesc.h | 6 +++
> mm/zsmalloc.c | 115 +++++++++++++++++++++++++++++++++-----------------
> 2 files changed, 82 insertions(+), 39 deletions(-)
>
> diff --git a/mm/zpdesc.h b/mm/zpdesc.h
> index 79ec40b03956..2293453f5d57 100644
> --- a/mm/zpdesc.h
> +++ b/mm/zpdesc.h
> @@ -102,4 +102,10 @@ static inline struct zpdesc *pfn_zpdesc(unsigned long pfn)
> {
> return page_zpdesc(pfn_to_page(pfn));
> }
> +
> +static inline void __zpdesc_set_movable(struct zpdesc *zpdesc,
> + const struct movable_operations *mops)
> +{
> + __SetPageMovable(zpdesc_page(zpdesc), mops);
> +}
> #endif
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index bbc165cb587d..a8f390beeab8 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -248,6 +248,41 @@ static inline void *zpdesc_kmap_atomic(struct zpdesc *zpdesc)
> return kmap_atomic(zpdesc_page(zpdesc));
> }
>
> +static inline void zpdesc_set_zspage(struct zpdesc *zpdesc,
> + struct zspage *zspage)
> +{
> + zpdesc->zspage = zspage;
> +}
> +
> +static inline void zpdesc_set_first(struct zpdesc *zpdesc)
> +{
> + SetPagePrivate(zpdesc_page(zpdesc));
> +}
> +
I'm not a fan of the names above. IMO, naming should follow some
semblance of consistency regarding their purpose (or have comments
that describe their purpose instead).
At a glance zpdesc_set_zspage() and zpdesc_set_first() sound like they
are doing similar things, but I don't think they serve similar purposes?
> +static inline void zpdesc_inc_zone_page_state(struct zpdesc *zpdesc)
> +{
> + inc_zone_page_state(zpdesc_page(zpdesc), NR_ZSPAGES);
> +}
> +
> +static inline void zpdesc_dec_zone_page_state(struct zpdesc *zpdesc)
> +{
> + dec_zone_page_state(zpdesc_page(zpdesc), NR_ZSPAGES);
> +}
> +
> +static inline struct zpdesc *alloc_zpdesc(gfp_t gfp)
> +{
> + struct page *page = alloc_page(gfp);
> +
> + return page_zpdesc(page);
> +}
> +
> +static inline void free_zpdesc(struct zpdesc *zpdesc)
> +{
> + struct page *page = zpdesc_page(zpdesc);
> +
> + __free_page(page);
> +}
> +
Powered by blists - more mailing lists