From: sashiko-bot@kernel.org
To: "Henry Martin" <bsdhenrymartin@gmail.com>,
"Matthew Wilcox" <willy@infradead.org>, "Jan Kara" <jack@suse.cz>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Nhat Pham" <nphamcs@gmail.com>,
"Johannes Weiner" <hannes@cmpxchg.org>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH] mm: fix cachestat NULL pgdat dereference on DAX mappings
Date: Tue, 24 Nov 2026 02:58:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-230432@kernel.org> (raw)
In-Reply-To: <20261123030014.3116755-1-bsdhenrymartin@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] mm: skipped dirty accounting for DAX entries in
filemap_cachestat()
- [Low] mm: inaccurate commit message claim on PMD-order DAX entry count
--
commit 00a07291e64203188f9848c4b4c587fb6f5215ca
Author: Henry Martin <bsdhenrymartin@gmail.com>
mm: fix cachestat NULL pgdat dereference on DAX mappings
This commit avoids decoding DAX exceptional value entries as workingset
shadows in filemap_cachestat(), counting them as cached pages instead.
> PMD-order entries
> are counted as one page, as value entries carry no order information.
[Severity: Low]
Is this statement in the commit message accurate?
dax_iomap_pmd_fault() and dax_insert_pfn_mkwrite() insert PMD entries with
XA_STATE_ORDER(..., PMD_ORDER), and filemap_cachestat() derives nr_pages
from xas_get_order(&xas) before checking xa_is_value(folio), so PMD-order
DAX entries are counted across all pages they cover.
> diff --git a/mm/filemap.c b/mm/filemap.c
> index dc0ceaa58a0f7..5d12230de32d9 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -4706,6 +4706,16 @@ static void filemap_cachestat(struct address_space *mapping,
> void *shadow = (void *)folio;
> bool workingset; /* not used */
>
> + /*
> + * DAX exceptional entries track present pages, not
> + * evicted folios. They must not be decoded as
> + * workingset shadows.
> + */
> + if (dax_mapping(mapping)) {
> + cs->nr_cache += nr_pages;
> + goto resched;
> + }
> +
> cs->nr_evicted += nr_pages;
>
> #ifdef CONFIG_SWAP /* implies CONFIG_MMU */
[Severity: Medium]
Does jumping to resched here skip cs->nr_dirty accounting for dirty DAX
entries?
DAX marks dirty exceptional entries with PAGECACHE_TAG_DIRTY in
mapping->i_pages (via dax_insert_entry() and dax_insert_pfn_mkwrite())
until writeback flushes CPU caches. Because the in-cache path below only
queries &xas and never dereferences folio, guarding the evicted branch
with "if (xa_is_value(folio) && !dax_mapping(mapping))" would avoid
duplicating cs->nr_cache += nr_pages and preserve cs->nr_dirty reporting
via xas_get_mark(&xas, PAGECACHE_TAG_DIRTY).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123030014.3116755-1-bsdhenrymartin@gmail.com?part=1
next prev parent reply other threads:[~2026-11-24 2:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 3:00 [PATCH] mm: fix cachestat NULL pgdat dereference on DAX mappings Henry Martin
2026-11-24 2:58 ` sashiko-bot [this message]
2026-11-24 12:42 ` Jan Kara
2026-11-24 15:58 ` Nhat Pham
2026-11-25 3:13 ` henry martin
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=sashiko-outbox-230432@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bsdhenrymartin@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=willy@infradead.org \
/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.