Skip to content

Commit 2ca456c

Browse files
author
Matthew Wilcox (Oracle)
committed
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) <[email protected]>
1 parent cd125ee commit 2ca456c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mm/page-writeback.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,10 +2602,12 @@ EXPORT_SYMBOL(folio_redirty_for_writepage);
26022602
* folio_mark_dirty - Mark a folio as being modified.
26032603
* @folio: The folio.
26042604
*
2605-
* For folios with a mapping this should be done with the folio lock held
2606-
* for the benefit of asynchronous memory errors who prefer a consistent
2607-
* dirty state. This rule can be broken in some special cases,
2608-
* but should be better not to.
2605+
* The folio may not be truncated while this function is running.
2606+
* Holding the folio lock is sufficient to prevent truncation, but some
2607+
* callers cannot acquire a sleeping lock. These callers instead hold
2608+
* the page table lock for a page table which contains at least one page
2609+
* in this folio. Truncation will block on the page table lock as it
2610+
* unmaps pages before removing the folio from its mapping.
26092611
*
26102612
* Return: True if the folio was newly dirtied, false if it was already dirty.
26112613
*/

0 commit comments

Comments
 (0)