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: <20240116203210.52843-1-sj@kernel.org>
Date: Tue, 16 Jan 2024 12:32:10 -0800
From: SeongJae Park <sj@...nel.org>
To: Honggyu Kim <honggyu.kim@...com>
Cc: sj@...nel.org,
	damon@...ts.linux.dev,
	linux-mm@...ck.org,
	linux-trace-kernel@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	kernel_team@...ynix.com,
	akpm@...ux-foundation.org,
	apopple@...dia.com,
	baolin.wang@...ux.alibaba.com,
	dave.jiang@...el.com,
	linmiaohe@...wei.com,
	lizhijian@...fujitsu.com,
	mathieu.desnoyers@...icios.com,
	mhiramat@...nel.org,
	rostedt@...dmis.org,
	surenb@...gle.com,
	yangx.jy@...itsu.com,
	ying.huang@...el.com,
	ziy@...dia.com
Subject: Re: [RFC PATCH 1/4] mm/vmscan: refactor reclaim_pages with reclaim_or_migrate_folios

On Mon, 15 Jan 2024 13:52:49 +0900 Honggyu Kim <honggyu.kim@...com> wrote:

> Since we will introduce reclaim_pages like functions such as
> demote_pages and promote_pages, the most of the code can be shared.
> 
> This is a preparation patch that introduces reclaim_or_migrate_folios()
> to cover all the logics, but it provides a handler for the different
> actions.
> 
> No functional changes applied.
> 
> Signed-off-by: Honggyu Kim <honggyu.kim@...com>
> ---
>  mm/vmscan.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index bba207f41b14..7ca2396ccc3b 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2107,15 +2107,16 @@ static unsigned int reclaim_folio_list(struct list_head *folio_list,
>  	return nr_reclaimed;
>  }
>  
> -unsigned long reclaim_pages(struct list_head *folio_list)
> +static unsigned long reclaim_or_migrate_folios(struct list_head *folio_list,
> +		unsigned int (*handler)(struct list_head *, struct pglist_data *))

I'm not very sure if extending this function for general migration is the right
approach, since we have dedicated functions for the migration.

I'd like to hear others' opinions.

>  {
>  	int nid;
> -	unsigned int nr_reclaimed = 0;
> +	unsigned int nr_folios = 0;
>  	LIST_HEAD(node_folio_list);
>  	unsigned int noreclaim_flag;
>  
>  	if (list_empty(folio_list))
> -		return nr_reclaimed;
> +		return nr_folios;
>  
>  	noreclaim_flag = memalloc_noreclaim_save();
>  
> @@ -2129,15 +2130,20 @@ unsigned long reclaim_pages(struct list_head *folio_list)
>  			continue;
>  		}
>  
> -		nr_reclaimed += reclaim_folio_list(&node_folio_list, NODE_DATA(nid));
> +		nr_folios += handler(&node_folio_list, NODE_DATA(nid));
>  		nid = folio_nid(lru_to_folio(folio_list));
>  	} while (!list_empty(folio_list));
>  
> -	nr_reclaimed += reclaim_folio_list(&node_folio_list, NODE_DATA(nid));
> +	nr_folios += handler(&node_folio_list, NODE_DATA(nid));
>  
>  	memalloc_noreclaim_restore(noreclaim_flag);
>  
> -	return nr_reclaimed;
> +	return nr_folios;
> +}
> +
> +unsigned long reclaim_pages(struct list_head *folio_list)
> +{
> +	return reclaim_or_migrate_folios(folio_list, reclaim_folio_list);
>  }
>  
>  static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
> -- 
> 2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ