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: <a3cc7157-6ea0-4493-8baf-c988b9fa4dcb@gmail.com>
Date: Mon, 5 Aug 2024 16:20:15 +0800
From: Alex Shi <seakeel@...il.com>
To: Vishal Moola <vishal.moola@...il.com>, 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 8/3/24 3:09 AM, Vishal Moola wrote:
> 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.

Right, maybe too much helper doesn't give necessary help.

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

zpdesc_set_zspage() only used in one place, a helper maynot needed. Let me remove it.
Same thing for the alloc_zpdesc() and free_zpdesc(), they could be merge into using place.

Thanks
Alex
> 
>> +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

Powered by Openwall GNU/*/Linux Powered by OpenVZ