Re: [PATCH 3/8] mm: remove clear_page_dirty_for_io()

From: Lorenzo Stoakes (ARM)

Date: Tue Nov 03 2026 - 03:58:49 EST


On Mon, Nov 02, 2026 at 05:54:08PM -0500, Tal Zussman wrote:
> There are no callers left. Point the comments that named it at
> folio_clear_dirty_for_io() instead.
>
> Signed-off-by: Tal Zussman <tz2294@xxxxxxxxxxxx>

LGTM!

Reviewed-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>

> ---
> include/linux/pagemap.h | 1 -
> mm/folio-compat.c | 6 ------
> mm/gup.c | 6 +++---
> mm/page-writeback.c | 2 +-
> 4 files changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index 692ce3867a1d..9adfeae2153c 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -1315,7 +1315,6 @@ static inline void folio_cancel_dirty(struct folio *folio)
> __folio_cancel_dirty(folio);
> }
> bool folio_clear_dirty_for_io(struct folio *folio);
> -bool clear_page_dirty_for_io(struct page *page);
> void folio_invalidate(struct folio *folio, size_t offset, size_t length);
> bool noop_dirty_folio(struct address_space *mapping, struct folio *folio);
>
> diff --git a/mm/folio-compat.c b/mm/folio-compat.c
> index 9f2cd0ebfbbd..13d4d39e1896 100644
> --- a/mm/folio-compat.c
> +++ b/mm/folio-compat.c
> @@ -42,12 +42,6 @@ int set_page_dirty_lock(struct page *page)
> }
> EXPORT_SYMBOL(set_page_dirty_lock);
>
> -bool clear_page_dirty_for_io(struct page *page)
> -{
> - return folio_clear_dirty_for_io(page_folio(page));
> -}
> -EXPORT_SYMBOL(clear_page_dirty_for_io);
> -
> bool redirty_page_for_writepage(struct writeback_control *wbc,
> struct page *page)
> {
> diff --git a/mm/gup.c b/mm/gup.c
> index 7d43ce717b24..335dcb3a5c17 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -298,16 +298,16 @@ void unpin_user_pages_dirty_lock(struct page **pages, unsigned long npages,
> folio = gup_folio_next(pages, npages, i, &nr);
> /*
> * Checking PageDirty at this point may race with
> - * clear_page_dirty_for_io(), but that's OK. Two key
> + * folio_clear_dirty_for_io(), but that's OK. Two key
> * cases:
> *
> * 1) This code sees the page as already dirty, so it
> * skips the call to set_page_dirty(). That could happen
> - * because clear_page_dirty_for_io() called
> + * because folio_clear_dirty_for_io() called
> * folio_mkclean(), followed by set_page_dirty().
> * However, now the page is going to get written back,
> * which meets the original intention of setting it
> - * dirty, so all is well: clear_page_dirty_for_io() goes
> + * dirty, so all is well: folio_clear_dirty_for_io() goes
> * on to call TestClearPageDirty(), and write the page
> * back.
> *
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 0694ec4098f6..b56f2c91b0f2 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -2821,7 +2821,7 @@ EXPORT_SYMBOL(folio_mark_dirty_lock);
> * This cancels just the dirty bit on the kernel page itself, it does NOT
> * actually remove dirty bits on any mmap's that may be around. It also
> * leaves the page tagged dirty, so any sync activity will still find it on
> - * the dirty lists, and in particular, clear_page_dirty_for_io() will still
> + * the dirty lists, and in particular, folio_clear_dirty_for_io() will still
> * look at the dirty bits in the VM.
> *
> * Doing this should *normally* only ever be done when a page is truncated,
>
> --
> 2.39.5
>

--
Cheers, Lorenzo