All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@lst.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Al Viro <viro@zeniv.linux.org.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] mm/writeback: Move __set_page_dirty() to core mm
Date: Wed, 16 Jun 2021 17:14:23 +0100	[thread overview]
Message-ID: <YMojXxiyYTRaQvJs@casper.infradead.org> (raw)
In-Reply-To: <20210615162342.1669332-2-willy@infradead.org>

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.

  parent reply	other threads:[~2021-06-16 16:14 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 16:23 [PATCH 0/6] Further set_page_dirty cleanups Matthew Wilcox (Oracle)
2021-06-15 16:23 ` [PATCH 1/6] mm/writeback: Move __set_page_dirty() to core mm Matthew Wilcox (Oracle)
2021-06-15 16:35   ` Christoph Hellwig
2021-06-15 17:17   ` Greg Kroah-Hartman
2021-06-16 16:14   ` Matthew Wilcox [this message]
2021-06-15 16:23 ` [PATCH 2/6] mm/writeback: Use __set_page_dirty in __set_page_dirty_nobuffers Matthew Wilcox (Oracle)
2021-06-15 16:35   ` Christoph Hellwig
2021-06-15 17:18   ` Greg Kroah-Hartman
2021-06-15 16:23 ` [PATCH 3/6] iomap: Use __set_page_dirty_nobuffers Matthew Wilcox (Oracle)
2021-06-15 16:37   ` Christoph Hellwig
2021-06-15 17:19   ` Greg Kroah-Hartman
2021-06-15 17:32     ` Matthew Wilcox
2021-06-15 17:34       ` Christoph Hellwig
2021-06-15 18:04         ` Greg Kroah-Hartman
2021-06-15 18:13         ` Matthew Wilcox
2021-06-16  6:50           ` Greg Kroah-Hartman
2021-06-16 16:28             ` Matthew Wilcox
2021-06-16 16:35               ` Greg Kroah-Hartman
2021-06-15 16:23 ` [PATCH 4/6] fs: Remove anon_set_page_dirty() Matthew Wilcox (Oracle)
2021-06-15 16:37   ` Christoph Hellwig
2021-06-15 16:23 ` [PATCH 5/6] fs: Remove noop_set_page_dirty() Matthew Wilcox (Oracle)
2021-06-15 16:38   ` Christoph Hellwig
2021-06-16 18:10   ` kernel test robot
2021-06-16 18:10     ` kernel test robot
2021-06-16 18:12     ` Matthew Wilcox
2021-06-16 18:12       ` Matthew Wilcox
2021-06-16 22:33   ` kernel test robot
2021-06-16 22:33     ` kernel test robot
2021-06-15 16:23 ` [PATCH 6/6] mm: Move page dirtying prototypes from mm.h Matthew Wilcox (Oracle)
2021-06-15 16:39   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YMojXxiyYTRaQvJs@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.