lkml.org 
[lkml]   [2021]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/6] mm/writeback: Move __set_page_dirty() to core mm
On Tue, Jun 15, 2021 at 05:23:37PM +0100, Matthew Wilcox (Oracle) wrote:
> -/*
> - * Mark the page dirty, and set it dirty in the page cache, and mark the inode
> - * dirty.
> - *
> - * If warn is true, then emit a warning if the page is not uptodate and has
> - * not been truncated.
> - *
> - * The caller must hold lock_page_memcg().
> - */

Checking against my folio tree, I found a bit of extra documentation
that I had added and didn't make it into this submission. Let me know
if it's useful and if so I can submit it as a fixup patch:

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 73b937955cc1..2072787d9b44 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2466,7 +2466,11 @@ void account_page_cleaned(struct page *page, struct addre
ss_space *mapping,
* If warn is true, then emit a warning if the page is not uptodate and has
* not been truncated.
*
- * The caller must hold lock_page_memcg().
+ * The caller must hold lock_page_memcg(). Most callers have the page
+ * locked. A few have the page blocked from truncation through other
+ * means (eg zap_page_range() has it mapped and is holding the page table
+ * lock). This can also be called from mark_buffer_dirty(), which I
+ * cannot prove is always protected against truncate.
*/
void __set_page_dirty(struct page *page, struct address_space *mapping,
int warn)

... it's a bit "notes to self", so perhaps someone can clean it up.
In particular, someone who knows the buffer code better than I do can
prove that mark_buffer_dirty() is always protected against truncate.

\
 
 \ /
  Last update: 2021-06-16 18:15    [W:0.139 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site