linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Assert the folio is locked in folio_start_writeback()
@ 2025-02-26 15:36 Matthew Wilcox (Oracle)
  2025-02-26 16:21 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox (Oracle) @ 2025-02-26 15:36 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Matthew Wilcox (Oracle), linux-mm, linux-fsdevel

The folio must be locked when we start writeback in order to
prevent writeback from being started twice on the same folio.
I don't expect this to catch any problems, but it should be
good documentation.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/page-writeback.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index eb55ece39c56..8b325aa525eb 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -3109,6 +3109,7 @@ void __folio_start_writeback(struct folio *folio, bool keep_write)
 	int access_ret;
 
 	VM_BUG_ON_FOLIO(folio_test_writeback(folio), folio);
+	VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
 
 	if (mapping && mapping_use_writeback_tags(mapping)) {
 		XA_STATE(xas, &mapping->i_pages, folio_index(folio));
-- 
2.47.2



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: Assert the folio is locked in folio_start_writeback()
  2025-02-26 15:36 [PATCH] mm: Assert the folio is locked in folio_start_writeback() Matthew Wilcox (Oracle)
@ 2025-02-26 16:21 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2025-02-26 16:21 UTC (permalink / raw)
  To: Matthew Wilcox (Oracle); +Cc: Andrew Morton, linux-mm, linux-fsdevel

On Wed, Feb 26, 2025 at 03:36:12PM +0000, Matthew Wilcox (Oracle) wrote:
> The folio must be locked when we start writeback in order to
> prevent writeback from being started twice on the same folio.
> I don't expect this to catch any problems, but it should be
> good documentation.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

LGTM
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  mm/page-writeback.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index eb55ece39c56..8b325aa525eb 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -3109,6 +3109,7 @@ void __folio_start_writeback(struct folio *folio, bool keep_write)
>  	int access_ret;
>  
>  	VM_BUG_ON_FOLIO(folio_test_writeback(folio), folio);
> +	VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
>  
>  	if (mapping && mapping_use_writeback_tags(mapping)) {
>  		XA_STATE(xas, &mapping->i_pages, folio_index(folio));
> -- 
> 2.47.2
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-26 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-26 15:36 [PATCH] mm: Assert the folio is locked in folio_start_writeback() Matthew Wilcox (Oracle)
2025-02-26 16:21 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox