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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 3 Jun 2024 13:36:46 +0100
From: Matthew Wilcox <willy@...radead.org>
To: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
Cc: david@...morbit.com, chandan.babu@...cle.com, akpm@...ux-foundation.org,
	brauner@...nel.org, djwong@...nel.org, linux-kernel@...r.kernel.org,
	hare@...e.de, john.g.garry@...cle.com, gost.dev@...sung.com,
	yang@...amperecomputing.com, p.raghav@...sung.com,
	cl@...amperecomputing.com, linux-xfs@...r.kernel.org, hch@....de,
	mcgrof@...nel.org, linux-mm@...ck.org,
	linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v6 05/11] mm: split a folio in minimum folio order chunks

On Wed, May 29, 2024 at 03:45:03PM +0200, Pankaj Raghav (Samsung) wrote:
> @@ -3572,14 +3600,19 @@ static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start,
>  
>  	for (index = off_start; index < off_end; index += nr_pages) {
>  		struct folio *folio = filemap_get_folio(mapping, index);
> +		unsigned int min_order, target_order = new_order;
>  
>  		nr_pages = 1;
>  		if (IS_ERR(folio))
>  			continue;
>  
> -		if (!folio_test_large(folio))
> +		if (!folio->mapping || !folio_test_large(folio))
>  			goto next;

This check is useless.  folio->mapping is set to NULL on truncate,
but you haven't done anything to prevent truncate yet.  That happens
later when you lock the folio.

> +		min_order = mapping_min_folio_order(mapping);

You should hoist this out of the loop.

> +		if (new_order < min_order)
> +			target_order = min_order;
> +
>  		total++;
>  		nr_pages = folio_nr_pages(folio);
>  
> @@ -3589,7 +3622,18 @@ static int split_huge_pages_in_file(const char *file_path, pgoff_t off_start,
>  		if (!folio_trylock(folio))
>  			goto next;
>  
> -		if (!split_folio_to_order(folio, new_order))
> +		if (!folio_test_anon(folio)) {

Please explain how a folio _in a file_ can be anon?

> +			unsigned int min_order;
> +
> +			if (!folio->mapping)
> +				goto next;
> +
> +			min_order = mapping_min_folio_order(folio->mapping);
> +			if (new_order < target_order)
> +				target_order = min_order;

Why is this being repeated?

> +		}
> +
> +		if (!split_folio_to_order(folio, target_order))
>  			split++;
>  
>  		folio_unlock(folio);
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ