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]
Date: Thu, 21 Dec 2023 12:26:44 +0100
From: Jan Kara <jack@...e.cz>
To: Christoph Hellwig <hch@....de>
Cc: linux-mm@...ck.org, "Matthew Wilcox (Oracle)" <willy@...radead.org>,
	Jan Kara <jack@...e.com>, David Howells <dhowells@...hat.com>,
	Brian Foster <bfoster@...hat.com>, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/17] pagevec: Add ability to iterate a queue

On Mon 18-12-23 16:35:46, Christoph Hellwig wrote:
> From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
> 
> Add a loop counter inside the folio_batch to let us iterate from 0-nr
> instead of decrementing nr and treating the batch as a stack.  It would
> generate some very weird and suboptimal I/O patterns for page writeback
> to iterate over the batch as a stack.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> Signed-off-by: Christoph Hellwig <hch@....de>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  include/linux/pagevec.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
> index 87cc678adc850b..fcc06c300a72c3 100644
> --- a/include/linux/pagevec.h
> +++ b/include/linux/pagevec.h
> @@ -27,6 +27,7 @@ struct folio;
>   */
>  struct folio_batch {
>  	unsigned char nr;
> +	unsigned char i;
>  	bool percpu_pvec_drained;
>  	struct folio *folios[PAGEVEC_SIZE];
>  };
> @@ -40,12 +41,14 @@ struct folio_batch {
>  static inline void folio_batch_init(struct folio_batch *fbatch)
>  {
>  	fbatch->nr = 0;
> +	fbatch->i = 0;
>  	fbatch->percpu_pvec_drained = false;
>  }
>  
>  static inline void folio_batch_reinit(struct folio_batch *fbatch)
>  {
>  	fbatch->nr = 0;
> +	fbatch->i = 0;
>  }
>  
>  static inline unsigned int folio_batch_count(struct folio_batch *fbatch)
> @@ -75,6 +78,21 @@ static inline unsigned folio_batch_add(struct folio_batch *fbatch,
>  	return folio_batch_space(fbatch);
>  }
>  
> +/**
> + * folio_batch_next - Return the next folio to process.
> + * @fbatch: The folio batch being processed.
> + *
> + * Use this function to implement a queue of folios.
> + *
> + * Return: The next folio in the queue, or NULL if the queue is empty.
> + */
> +static inline struct folio *folio_batch_next(struct folio_batch *fbatch)
> +{
> +	if (fbatch->i == fbatch->nr)
> +		return NULL;
> +	return fbatch->folios[fbatch->i++];
> +}
> +
>  void __folio_batch_release(struct folio_batch *pvec);
>  
>  static inline void folio_batch_release(struct folio_batch *fbatch)
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ