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: <Z_fYsyEA9hSEOoxp@kernel.org>
Date: Thu, 10 Apr 2025 17:41:55 +0300
From: Mike Rapoport <rppt@...nel.org>
To: gaoxu <gaoxu2@...or.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	"surenb@...gle.com" <surenb@...gle.com>,
	Barry Song <21cnbao@...il.com>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	yipengxiang <yipengxiang@...or.com>
Subject: Re: [PATCH] mm: simplify zone_idx()

Hi,

On Thu, Apr 10, 2025 at 12:03:00PM +0000, gaoxu wrote:
> store zone_idx directly in struct zone to simplify and optimize zone_idx()

Do you see an actual speed up somewhere?
 
> Signed-off-by: gao xu <gaoxu2@...or.com>
> ---
>  include/linux/mmzone.h | 3 ++-
>  mm/mm_init.c           | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 4c95fcc9e..7b14f577d 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -941,6 +941,7 @@ struct zone {
>  #endif
>  
>  	const char		*name;
> +	enum zone_type	zone_idx;
>  
>  #ifdef CONFIG_MEMORY_ISOLATION
>  	/*
> @@ -1536,7 +1537,7 @@ static inline int local_memory_node(int node_id) { return node_id; };
>  /*
>   * zone_idx() returns 0 for the ZONE_DMA zone, 1 for the ZONE_NORMAL zone, etc.
>   */
> -#define zone_idx(zone)		((zone) - (zone)->zone_pgdat->node_zones)
> +#define zone_idx(zone)		((zone)->zone_idx)
>  
>  #ifdef CONFIG_ZONE_DEVICE
>  static inline bool zone_is_zone_device(struct zone *zone)
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 9659689b8..a7f7264f1 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -1425,6 +1425,7 @@ static void __meminit zone_init_internals(struct zone *zone, enum zone_type idx,
>  	atomic_long_set(&zone->managed_pages, remaining_pages);
>  	zone_set_nid(zone, nid);
>  	zone->name = zone_names[idx];
> +	zone->zone_idx = idx;
>  	zone->zone_pgdat = NODE_DATA(nid);
>  	spin_lock_init(&zone->lock);
>  	zone_seqlock_init(zone);
> -- 
> 2.17.1

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ