From: David Hildenbrand <david@redhat.com>
To: Alistair Popple <apopple@nvidia.com>
Cc: akpm@linux-foundation.org, dan.j.williams@intel.com,
linux-mm@kvack.org, Alison Schofield <alison.schofield@intel.com>,
lina@asahilina.net, zhang.lyra@gmail.com,
gerald.schaefer@linux.ibm.com, vishal.l.verma@intel.com,
dave.jiang@intel.com, logang@deltatee.com, bhelgaas@google.com,
jack@suse.cz, jgg@ziepe.ca, catalin.marinas@arm.com,
will@kernel.org, mpe@ellerman.id.au, npiggin@gmail.com,
dave.hansen@linux.intel.com, ira.weiny@intel.com,
willy@infradead.org, djwong@kernel.org, tytso@mit.edu,
linmiaohe@huawei.com, peterx@redhat.com,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev,
linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org,
jhubbard@nvidia.com, hch@lst.de, david@fromorbit.com,
chenhuacai@kernel.org, kernel@xen0n.name,
loongarch@lists.linux.dev
Subject: Re: [PATCH v8 19/20] fs/dax: Properly refcount fs dax pages
Date: Thu, 20 Feb 2025 12:51:41 +0100 [thread overview]
Message-ID: <f720d914-3d66-42a9-a65c-dbdd58d5bccd@redhat.com> (raw)
In-Reply-To: <jf6hr2uzyz76axd62v6czy3wzcuu4eb7ydow5mznehfuiwhqq3@2q7easkxhdp4>
>>> -static inline unsigned long dax_folio_share_put(struct folio *folio)
>>> +static inline unsigned long dax_folio_put(struct folio *folio)
>>> {
>>> - return --folio->page.share;
>>> + unsigned long ref;
>>> + int order, i;
>>> +
>>> + if (!dax_folio_is_shared(folio))
>>> + ref = 0;
>>> + else
>>> + ref = --folio->share;
>>> +
>>
>> out of interest, what synchronizes access to folio->share?
>
> Actually that's an excellent question as I hadn't looked too closely at this
> given I wasn't changing the overall flow with regards to synchronization, merely
> representation of the "shared" state. So I don't have a good answer for you off
> the top of my head - Dan maybe you can shed some light here?
Not that I understand what that dax-shared thing is or does, but the
non-atomic update on a folio_put path looked "surprising".
>>> diff --git a/include/linux/dax.h b/include/linux/dax.h
>>> index 2333c30..dcc9fcd 100644
>>> --- a/include/linux/dax.h
>>> +++ b/include/linux/dax.h
>>> @@ -209,7 +209,7 @@ int dax_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
>>
>> [...]
>>
>>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>>> index d189826..1a0d6a8 100644
>>> --- a/mm/huge_memory.c
>>> +++ b/mm/huge_memory.c
>>> @@ -2225,7 +2225,7 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
>>> tlb->fullmm);
>>> arch_check_zapped_pmd(vma, orig_pmd);
>>> tlb_remove_pmd_tlb_entry(tlb, pmd, addr);
>>> - if (vma_is_special_huge(vma)) {
>>> + if (!vma_is_dax(vma) && vma_is_special_huge(vma)) {
>>
>> I wonder if we actually want to remove the vma_is_dax() check from
>> vma_is_special_huge(), and instead add it to the remaining callers of
>> vma_is_special_huge() that still need it -- if any need it.
>>
>> Did we sanity-check which callers of vma_is_special_huge() still need it? Is
>> there still reason to have that DAX check in vma_is_special_huge()?
>
> If by "we" you mean "me" then yes :) There are still a few callers of it, mainly
> for page splitting.
Heh, "you or any of the reviewers" :)
So IIUC, the existing users still need the DAX check I assume (until
that part is cleaned up, below).
>
>> But vma_is_special_huge() is rather confusing from me ... the whole
>> vma_is_special_huge() thing should probably be removed. That's a cleanup for
>> another day, though.
>
> But after double checking I have come to the same conclusion as you - it should
> be removed. I will add that to my ever growing clean-up series that can go on
> top of this one.
Nice!
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-02-20 11:51 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 3:55 [PATCH v8 00/20] fs/dax: Fix ZONE_DEVICE page reference counts Alistair Popple
2025-02-18 3:55 ` [PATCH v8 01/20] fuse: Fix dax truncate/punch_hole fault path Alistair Popple
2025-02-18 3:55 ` [PATCH v8 02/20] fs/dax: Return unmapped busy pages from dax_layout_busy_page_range() Alistair Popple
2025-02-18 3:55 ` [PATCH v8 03/20] fs/dax: Don't skip locked entries when scanning entries Alistair Popple
2025-02-18 3:55 ` [PATCH v8 04/20] fs/dax: Refactor wait for dax idle page Alistair Popple
2025-02-18 3:55 ` [PATCH v8 05/20] fs/dax: Create a common implementation to break DAX layouts Alistair Popple
2025-02-18 3:55 ` [PATCH v8 06/20] fs/dax: Always remove DAX page-cache entries when breaking layouts Alistair Popple
2025-02-18 3:55 ` [PATCH v8 07/20] fs/dax: Ensure all pages are idle prior to filesystem unmount Alistair Popple
2025-02-18 3:55 ` [PATCH v8 08/20] fs/dax: Remove PAGE_MAPPING_DAX_SHARED mapping flag Alistair Popple
2025-02-18 3:55 ` [PATCH v8 09/20] mm/gup: Remove redundant check for PCI P2PDMA page Alistair Popple
2025-02-18 3:55 ` [PATCH v8 10/20] mm/mm_init: Move p2pdma page refcount initialisation to p2pdma Alistair Popple
2025-02-18 3:55 ` [PATCH v8 11/20] mm: Allow compound zone device pages Alistair Popple
2025-02-18 3:55 ` [PATCH v8 12/20] mm/memory: Enhance insert_page_into_pte_locked() to create writable mappings Alistair Popple
2025-02-18 3:55 ` [PATCH v8 13/20] mm/memory: Add vmf_insert_page_mkwrite() Alistair Popple
2025-02-18 3:55 ` [PATCH v8 14/20] mm/rmap: Add support for PUD sized mappings to rmap Alistair Popple
2025-02-18 3:55 ` [PATCH v8 15/20] mm/huge_memory: Add vmf_insert_folio_pud() Alistair Popple
2025-02-18 3:55 ` [PATCH v8 16/20] mm/huge_memory: Add vmf_insert_folio_pmd() Alistair Popple
2025-02-18 3:55 ` [PATCH v8 17/20] mm/gup: Don't allow FOLL_LONGTERM pinning of FS DAX pages Alistair Popple
2025-02-18 3:55 ` [PATCH v8 18/20] dcssblk: Mark DAX broken, remove FS_DAX_LIMITED support Alistair Popple
2025-02-18 3:55 ` [PATCH v8 19/20] fs/dax: Properly refcount fs dax pages Alistair Popple
2025-02-18 11:37 ` David Hildenbrand
2025-02-18 23:30 ` Alistair Popple
2025-02-20 11:51 ` David Hildenbrand [this message]
2025-02-18 3:55 ` [PATCH v8 20/20] device/dax: Properly refcount device dax pages when mapping Alistair Popple
2025-02-20 18:33 ` Gerald Schaefer
2025-02-25 6:23 ` Alistair Popple
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=f720d914-3d66-42a9-a65c-dbdd58d5bccd@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=apopple@nvidia.com \
--cc=bhelgaas@google.com \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dave.jiang@intel.com \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=gerald.schaefer@linux.ibm.com \
--cc=hch@lst.de \
--cc=ira.weiny@intel.com \
--cc=jack@suse.cz \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=kernel@xen0n.name \
--cc=lina@asahilina.net \
--cc=linmiaohe@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=logang@deltatee.com \
--cc=loongarch@lists.linux.dev \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=nvdimm@lists.linux.dev \
--cc=peterx@redhat.com \
--cc=tytso@mit.edu \
--cc=vishal.l.verma@intel.com \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=zhang.lyra@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).