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: <20241002155555.7fc4c6e294c75e2510426598@linux-foundation.org>
Date: Wed, 2 Oct 2024 15:55:55 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Shakeel Butt <shakeel.butt@...ux.dev>
Cc: Johannes Weiner <hannes@...xchg.org>, Matthew Wilcox
 <willy@...radead.org>, Yu Zhao <yuzhao@...gle.com>,
 linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org, Meta kernel team <kernel-team@...a.com>
Subject: Re: [PATCH] mm/truncate: reset xa_has_values flag on each iteration

On Wed,  2 Oct 2024 15:51:50 -0700 Shakeel Butt <shakeel.butt@...ux.dev> wrote:

> Currently mapping_try_invalidate() and invalidate_inode_pages2_range()
> traverses the xarray in batches and then for each batch, maintains and
> set the flag named xa_has_values if the batch has a shadow entry to
> clear the entries at the end of the iteration. However they forgot to
> reset the flag at the end of the iteration which cause them to always
> try to clear the shadow entries in the subsequent iterations where
> there might not be any shadow entries. Fixing it.
> 

So this is an efficiency thing, no other effects expected?

> --- a/mm/truncate.c
> +++ b/mm/truncate.c
> @@ -463,10 +463,10 @@ unsigned long mapping_try_invalidate(struct address_space *mapping,
>  	unsigned long ret;
>  	unsigned long count = 0;
>  	int i;
> -	bool xa_has_values = false;
>  
>  	folio_batch_init(&fbatch);
>  	while (find_lock_entries(mapping, &index, end, &fbatch, indices)) {
> +		bool xa_has_values = false;
>  		int nr = folio_batch_count(&fbatch);
>  
>  		for (i = 0; i < nr; i++) {
> @@ -592,7 +592,6 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
>  	int ret = 0;
>  	int ret2 = 0;
>  	int did_range_unmap = 0;
> -	bool xa_has_values = false;
>  
>  	if (mapping_empty(mapping))
>  		return 0;
> @@ -600,6 +599,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
>  	folio_batch_init(&fbatch);
>  	index = start;
>  	while (find_get_entries(mapping, &index, end, &fbatch, indices)) {
> +		bool xa_has_values = false;
>  		int nr = folio_batch_count(&fbatch);
>  
>  		for (i = 0; i < nr; i++) {
> -- 
> 2.43.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ