summaryrefslogtreecommitdiff
path: root/mm/page-writeback.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-04-28 14:21:02 -0400
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-05-08 14:45:56 -0400
commit2ca456c24801e439256c0ec7dbe21eba7b01544e (patch)
tree6730e972a296525238ffabc11cf415c9d16772fd /mm/page-writeback.c
parentcd125eeab2de8ef8ca3a0f3a284bc695375c73af (diff)
downloadlwn-2ca456c24801e439256c0ec7dbe21eba7b01544e.tar.gz
lwn-2ca456c24801e439256c0ec7dbe21eba7b01544e.zip
filemap: Update the folio_mark_dirty documentation
The previous comment was not terribly helpful. Be a bit more explicit about the necessary locking environment. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'mm/page-writeback.c')
-rw-r--r--mm/page-writeback.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 7e2da284e427..fa1117db4610 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2602,10 +2602,12 @@ EXPORT_SYMBOL(folio_redirty_for_writepage);
* folio_mark_dirty - Mark a folio as being modified.
* @folio: The folio.
*
- * For folios with a mapping this should be done with the folio lock held
- * for the benefit of asynchronous memory errors who prefer a consistent
- * dirty state. This rule can be broken in some special cases,
- * but should be better not to.
+ * The folio may not be truncated while this function is running.
+ * Holding the folio lock is sufficient to prevent truncation, but some
+ * callers cannot acquire a sleeping lock. These callers instead hold
+ * the page table lock for a page table which contains at least one page
+ * in this folio. Truncation will block on the page table lock as it
+ * unmaps pages before removing the folio from its mapping.
*
* Return: True if the folio was newly dirtied, false if it was already dirty.
*/