Separate out THP logic so we can drop an indentation level and reduce the
amount of noise in this function.
We add pagemap_pmd_range_thp() for this purpose.
While we're here, convert the VM_BUG_ON() to a VM_WARN_ON_ONCE() at the
same time.
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
fs/proc/task_mmu.c | 146 +++++++++++++++++++++++----------------------
1 file changed, 76 insertions(+), 70 deletions(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 5475acfa1a33..3c8be2579253 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1984,91 +1984,97 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm,
return make_pme(frame, flags);
}
-static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
- struct mm_walk *walk)
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+static int pagemap_pmd_range_thp(pmd_t *pmdp, unsigned long addr,
+ unsigned long end, struct vm_area_struct *vma,
+ struct pagemapread *pm, spinlock_t *ptl)
{
- struct vm_area_struct *vma = walk->vma;
- struct pagemapread *pm = walk->private;
- spinlock_t *ptl;
- pte_t *pte, *orig_pte;
+ unsigned int idx = (addr & ~PMD_MASK) >> PAGE_SHIFT;
+ u64 flags = 0, frame = 0;
+ pmd_t pmd = *pmdp;
+ struct page *page = NULL;
+ struct folio *folio = NULL;
int err = 0;
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
- ptl = pmd_trans_huge_lock(pmdp, vma);
- if (ptl) {
- unsigned int idx = (addr & ~PMD_MASK) >> PAGE_SHIFT;
- u64 flags = 0, frame = 0;
- pmd_t pmd = *pmdp;
- struct page *page = NULL;
- struct folio *folio = NULL;
+ if (vma->vm_flags & VM_SOFTDIRTY)
+ flags |= PM_SOFT_DIRTY;
- if (vma->vm_flags & VM_SOFTDIRTY)
- flags |= PM_SOFT_DIRTY;
+ if (pmd_present(pmd)) {
+ page = pmd_page(pmd);
- if (pmd_present(pmd)) {
- page = pmd_page(pmd);
+ flags |= PM_PRESENT;
+ if (pmd_soft_dirty(pmd))
+ flags |= PM_SOFT_DIRTY;
+ if (pmd_uffd_wp(pmd))
+ flags |= PM_UFFD_WP;
+ if (pm->show_pfn)
+ frame = pmd_pfn(pmd) + idx;
+ } else if (thp_migration_supported() && is_swap_pmd(pmd)) {
+ swp_entry_t entry = pmd_to_swp_entry(pmd);
+ unsigned long offset;
- flags |= PM_PRESENT;
- if (pmd_soft_dirty(pmd))
- flags |= PM_SOFT_DIRTY;
- if (pmd_uffd_wp(pmd))
- flags |= PM_UFFD_WP;
- if (pm->show_pfn)
- frame = pmd_pfn(pmd) + idx;
- }
-#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
- else if (is_swap_pmd(pmd)) {
- swp_entry_t entry = pmd_to_swp_entry(pmd);
- unsigned long offset;
-
- if (pm->show_pfn) {
- if (is_pfn_swap_entry(entry))
- offset = swp_offset_pfn(entry) + idx;
- else
- offset = swp_offset(entry) + idx;
- frame = swp_type(entry) |
- (offset << MAX_SWAPFILES_SHIFT);
- }
- flags |= PM_SWAP;
- if (pmd_swp_soft_dirty(pmd))
- flags |= PM_SOFT_DIRTY;
- if (pmd_swp_uffd_wp(pmd))
- flags |= PM_UFFD_WP;
- VM_BUG_ON(!is_pmd_migration_entry(pmd));
- page = pfn_swap_entry_to_page(entry);
+ if (pm->show_pfn) {
+ if (is_pfn_swap_entry(entry))
+ offset = swp_offset_pfn(entry) + idx;
+ else
+ offset = swp_offset(entry) + idx;
+ frame = swp_type(entry) |
+ (offset << MAX_SWAPFILES_SHIFT);
}
-#endif
+ flags |= PM_SWAP;
+ if (pmd_swp_soft_dirty(pmd))
+ flags |= PM_SOFT_DIRTY;
+ if (pmd_swp_uffd_wp(pmd))
+ flags |= PM_UFFD_WP;
+ VM_WARN_ON_ONCE(!is_pmd_migration_entry(pmd));
+ page = pfn_swap_entry_to_page(entry);
+ }
- if (page) {
- folio = page_folio(page);
- if (!folio_test_anon(folio))
- flags |= PM_FILE;
- }
+ if (page) {
+ folio = page_folio(page);
+ if (!folio_test_anon(folio))
+ flags |= PM_FILE;
+ }
- for (; addr != end; addr += PAGE_SIZE, idx++) {
- u64 cur_flags = flags;
- pagemap_entry_t pme;
+ for (; addr != end; addr += PAGE_SIZE, idx++) {
+ u64 cur_flags = flags;
+ pagemap_entry_t pme;
- if (folio && (flags & PM_PRESENT) &&
- __folio_page_mapped_exclusively(folio, page))
- cur_flags |= PM_MMAP_EXCLUSIVE;
+ if (folio && (flags & PM_PRESENT) &&
+ __folio_page_mapped_exclusively(folio, page))
+ cur_flags |= PM_MMAP_EXCLUSIVE;
- pme = make_pme(frame, cur_flags);
- err = add_to_pagemap(&pme, pm);
- if (err)
- break;
- if (pm->show_pfn) {
- if (flags & PM_PRESENT)
- frame++;
- else if (flags & PM_SWAP)
- frame += (1 << MAX_SWAPFILES_SHIFT);
- }
+ pme = make_pme(frame, cur_flags);
+ err = add_to_pagemap(&pme, pm);
+ if (err)
+ break;
+ if (pm->show_pfn) {
+ if (flags & PM_PRESENT)
+ frame++;
+ else if (flags & PM_SWAP)
+ frame += (1 << MAX_SWAPFILES_SHIFT);
}
- spin_unlock(ptl);
- return err;
}
+ spin_unlock(ptl);
+ return err;
+}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
+static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
+ struct mm_walk *walk)
+{
+ struct vm_area_struct *vma = walk->vma;
+ struct pagemapread *pm = walk->private;
+ spinlock_t *ptl;
+ pte_t *pte, *orig_pte;
+ int err = 0;
+
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+ ptl = pmd_trans_huge_lock(pmdp, vma);
+ if (ptl)
+ return pagemap_pmd_range_thp(pmdp, addr, end, vma, pm, ptl);
+#endif
+
/*
* We can assume that @vma always points to a valid one and @end never
* goes beyond vma->vm_end.
--
2.51.0
On Fri, Oct 24, 2025 at 08:41:21AM +0100, Lorenzo Stoakes wrote:
> Separate out THP logic so we can drop an indentation level and reduce the
> amount of noise in this function.
>
> We add pagemap_pmd_range_thp() for this purpose.
>
> While we're here, convert the VM_BUG_ON() to a VM_WARN_ON_ONCE() at the
> same time.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
... >8
> +static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
> + struct mm_walk *walk)
> +{
> + struct vm_area_struct *vma = walk->vma;
> + struct pagemapread *pm = walk->private;
> + spinlock_t *ptl;
> + pte_t *pte, *orig_pte;
> + int err = 0;
> +
> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> + ptl = pmd_trans_huge_lock(pmdp, vma);
> + if (ptl)
> + return pagemap_pmd_range_thp(pmdp, addr, end, vma, pm, ptl);
> +#endif
Maybe something like...
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
ptl = pmd_trans_huge_lock(pmdp, vma);
if (ptl) {
err = pagemap_pmd_range_thp(pmdp, addr, end, vma, pm, ptl);
spin_unlock(ptl);
return err;
}
#endif
and drop the spin_unlock(ptl) calls from pagemap_pmd_range_thp?
Makes it easier to understand the locking semantics.
Might be worth adding a comment to pagemap_pmd_range_thp that callers
must hold the ptl lock.
~Gregory
P.S. This patch set made my day, the whole non-swap-swap thing has
always broken my brain. <3
On Fri, Oct 24, 2025 at 01:32:29PM -0400, Gregory Price wrote:
> On Fri, Oct 24, 2025 at 08:41:21AM +0100, Lorenzo Stoakes wrote:
> > Separate out THP logic so we can drop an indentation level and reduce the
> > amount of noise in this function.
> >
> > We add pagemap_pmd_range_thp() for this purpose.
> >
> > While we're here, convert the VM_BUG_ON() to a VM_WARN_ON_ONCE() at the
> > same time.
> >
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ... >8
> > +static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end,
> > + struct mm_walk *walk)
> > +{
> > + struct vm_area_struct *vma = walk->vma;
> > + struct pagemapread *pm = walk->private;
> > + spinlock_t *ptl;
> > + pte_t *pte, *orig_pte;
> > + int err = 0;
> > +
> > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> > + ptl = pmd_trans_huge_lock(pmdp, vma);
> > + if (ptl)
> > + return pagemap_pmd_range_thp(pmdp, addr, end, vma, pm, ptl);
> > +#endif
>
> Maybe something like...
>
> #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> ptl = pmd_trans_huge_lock(pmdp, vma);
> if (ptl) {
> err = pagemap_pmd_range_thp(pmdp, addr, end, vma, pm, ptl);
> spin_unlock(ptl);
> return err;
> }
> #endif
>
> and drop the spin_unlock(ptl) calls from pagemap_pmd_range_thp?
Ah yeah that's a good idea, will do that on respin!
>
> Makes it easier to understand the locking semantics.
Absolutely.
>
> Might be worth adding a comment to pagemap_pmd_range_thp that callers
> must hold the ptl lock.
Ack will do!
>
> ~Gregory
>
> P.S. This patch set made my day, the whole non-swap-swap thing has
> always broken my brain. <3
Thanks :) yeah this came out of my advocating _for_ is_swap_pte() on a series,
because hey - if you're going to operate on PTEs based on them being 'xxx', and
you have a predicate 'is_xxx()' it follows that you should only do those
operations if you have applied the predicate right?
But of course we largely don't do that, so we end up with horrible confusion
between a convention that not-none, not-present = swap entry + this predicate.
PLUS on top of that, we have the 'non-swap swap entry' so we have not-none,
not-present = swap, or swap that is not swap but also swap but hey definitely
isn't and and... :)
A next step will be to at least rename swp_entry_t to something else, because
every last remnant of this 'swap entries but not really' needs to be dealt
with...
Anyway this goes a long way to getting there :)
Cheers, Lorenzo
On Fri, Oct 24, 2025 at 07:19:11PM +0100, Lorenzo Stoakes wrote: > On Fri, Oct 24, 2025 at 01:32:29PM -0400, Gregory Price wrote: > > A next step will be to at least rename swp_entry_t to something else, because > every last remnant of this 'swap entries but not really' needs to be dealt > with... > hah, was just complaining about this on the other patch. ptleaf_entry_t? :shrug: keep fighting the good fight ~Gregory
On Fri, Oct 24, 2025 at 03:12:08PM -0400, Gregory Price wrote: > On Fri, Oct 24, 2025 at 07:19:11PM +0100, Lorenzo Stoakes wrote: > > On Fri, Oct 24, 2025 at 01:32:29PM -0400, Gregory Price wrote: > > > > A next step will be to at least rename swp_entry_t to something else, because > > every last remnant of this 'swap entries but not really' needs to be dealt > > with... > > > > hah, was just complaining about this on the other patch. > > ptleaf_entry_t? Well you kinda want to differentiate it from a normal present page table leaf, but I really like 'non-present entry' as a description for (what were) non-swap entries so that's out. So maybe actually that isn't too bad of an idea... Could also be nonpresent_or_swap_t but that's kinda icky... Naming is hard :) > > :shrug: > > keep fighting the good fight > ~Gregory Always sir! ;) Cheers, Lorenzo
On Fri, Oct 24, 2025 at 09:15:59PM +0100, Lorenzo Stoakes wrote:
> On Fri, Oct 24, 2025 at 03:12:08PM -0400, Gregory Price wrote:
>
> So maybe actually that isn't too bad of an idea...
>
> Could also be
>
> nonpresent_or_swap_t but that's kinda icky...
clearly we need:
union {
swp_entry_t swap;
nonpresent_entry_t np;
pony_entry_t pony;
plum_emtry_t beer;
} leaf_entry_t;
with
leaf_type whats_that_pte(leaf_entry_t);
with 20 more new functions about how to manage leaf_entries ;]
no not seriously, please have a good weekend!
and thanks again for doing this!
~Gregory
On Fri, Oct 24, 2025 at 04:37:18PM -0400, Gregory Price wrote:
> On Fri, Oct 24, 2025 at 09:15:59PM +0100, Lorenzo Stoakes wrote:
> > On Fri, Oct 24, 2025 at 03:12:08PM -0400, Gregory Price wrote:
> >
> > So maybe actually that isn't too bad of an idea...
> >
> > Could also be
> >
> > nonpresent_or_swap_t but that's kinda icky...
>
> clearly we need:
>
> union {
> swp_entry_t swap;
> nonpresent_entry_t np;
> pony_entry_t pony;
> plum_emtry_t beer;
> } leaf_entry_t;
>
> with
>
> leaf_type whats_that_pte(leaf_entry_t);
I think if you are going to try to rename swp_entry_t that is a pretty
good idea. Maybe swleaf_entry_t to pace emphasis that it is not used
by the HW page table walker would be a good compromise to the ugly
'non-present entry' term.
Jason
On Mon, Oct 27, 2025 at 01:11:46PM -0300, Jason Gunthorpe wrote:
> On Fri, Oct 24, 2025 at 04:37:18PM -0400, Gregory Price wrote:
> > On Fri, Oct 24, 2025 at 09:15:59PM +0100, Lorenzo Stoakes wrote:
> > > On Fri, Oct 24, 2025 at 03:12:08PM -0400, Gregory Price wrote:
> > >
> > > So maybe actually that isn't too bad of an idea...
> > >
> > > Could also be
> > >
> > > nonpresent_or_swap_t but that's kinda icky...
> >
> > clearly we need:
> >
> > union {
> > swp_entry_t swap;
> > nonpresent_entry_t np;
> > pony_entry_t pony;
> > plum_emtry_t beer;
> > } leaf_entry_t;
I think Greg meant this as a joke [correct me if wrong] :) that was my
impression anyway (see original end of email...)
> >
> > with
> >
> > leaf_type whats_that_pte(leaf_entry_t);
>
> I think if you are going to try to rename swp_entry_t that is a pretty
Will reply elsewhere, but yes that's the intent.
> good idea. Maybe swleaf_entry_t to pace emphasis that it is not used
I get the point but that's kinda a horrible name visually.
sw_leaf_entry_t too... yeah maybe we can just put the software bit in a comment
maybe :)
> by the HW page table walker would be a good compromise to the ugly
> 'non-present entry' term.
I like leaf_entry_t name-wise.
I don't love the union.
How would we determine what type it is, we'd have to have some
generic_leaf_entry_t type or something to contain the swap type field and then
cast and... is it worth it?
Intent of non-present was to refer to not-swap swapentry. It's already a
convention that exists, e.g. is_pmd_non_present_folio_entry().
>
> Jason
>
Cheers, Lorenzo
On Mon, Oct 27, 2025 at 04:26:54PM +0000, Lorenzo Stoakes wrote:
> On Mon, Oct 27, 2025 at 01:11:46PM -0300, Jason Gunthorpe wrote:
> > On Fri, Oct 24, 2025 at 04:37:18PM -0400, Gregory Price wrote:
> > > On Fri, Oct 24, 2025 at 09:15:59PM +0100, Lorenzo Stoakes wrote:
> > > > On Fri, Oct 24, 2025 at 03:12:08PM -0400, Gregory Price wrote:
> > > >
> > > > So maybe actually that isn't too bad of an idea...
> > > >
> > > > Could also be
> > > >
> > > > nonpresent_or_swap_t but that's kinda icky...
> > >
> > > clearly we need:
> > >
> > > union {
> > > swp_entry_t swap;
> > > nonpresent_entry_t np;
> > > pony_entry_t pony;
> > > plum_emtry_t beer;
> > > } leaf_entry_t;
>
> I think Greg meant this as a joke [correct me if wrong] :) that was my
> impression anyway (see original end of email...)
>
> I like leaf_entry_t name-wise.
>
> I don't love the union.
>
The union was definitely a joke - see `plum_entry_t beer`
There definitely shouldn't be enough extensions to warrant a union here,
that seems like negative value.
leaf_entry_t naming replacing swp_entry_t seems reasonable since that's
basically all swp_entry_t is in its current form - even according to the
this set's cover letter:
```
There's an established convention in the kernel that we treat leaf page
tables (so far at the PTE, PMD level) as containing 'swap entries' should
they be neither empty (i.e. p**_none() evaluating true) nor present
(i.e. p**_present() evaluating true).
```
~Gregory
> > I don't love the union. > > How would we determine what type it is, we'd have to have some > generic_leaf_entry_t type or something to contain the swap type field and then > cast and... is it worth it? > > Intent of non-present was to refer to not-swap swapentry. It's already a > convention that exists, e.g. is_pmd_non_present_folio_entry(). Just noting that this was a recent addition (still not upstream) that essentially says "there is a folio here, but it's not in an ordinary present page table entry. So we could change that to something better. -- Cheers David / dhildenb
On Mon, Oct 27, 2025 at 05:31:54PM +0100, David Hildenbrand wrote: > > > > I don't love the union. > > > > How would we determine what type it is, we'd have to have some > > generic_leaf_entry_t type or something to contain the swap type field and then > > cast and... is it worth it? > > > > Intent of non-present was to refer to not-swap swapentry. It's already a > > convention that exists, e.g. is_pmd_non_present_folio_entry(). > > Just noting that this was a recent addition (still not upstream) that > essentially says "there is a folio here, but it's not in an ordinary present > page table entry. > > So we could change that to something better. Yeah but leaf_entry_t encapsulates BOTH swap and non-swap entries. So that's nice. What do you propose calling non-swap leaf entries? It starts spiralling down a bit there. And it's really common to have logic asserting it's actually a swap entry vs. not etc. I think we need to separate out what's practical for this series and what's ideal going forwards. Right now it's a complete mess, I don't want this to turn into a talking shop that bogs things down so we don't move forward because it doesn't address everything all at once. What we have here already improves things dramatically IMO. So what I propose is: 1. we keep the non-present terminology as a better way of referring to non-swap entries. 2. When I come to do the leaf_entry_t series, we can generalise and no longer differentiate between swap + non-swap. We can then resume the discussion re: type there. > > -- > Cheers > > David / dhildenb > THanks, Lorenzo
On Mon, Oct 27, 2025 at 04:38:05PM +0000, Lorenzo Stoakes wrote: > On Mon, Oct 27, 2025 at 05:31:54PM +0100, David Hildenbrand wrote: > > > > > > I don't love the union. > > > > > > How would we determine what type it is, we'd have to have some > > > generic_leaf_entry_t type or something to contain the swap type field and then > > > cast and... is it worth it? > > > > > > Intent of non-present was to refer to not-swap swapentry. It's already a > > > convention that exists, e.g. is_pmd_non_present_folio_entry(). > > > > Just noting that this was a recent addition (still not upstream) that > > essentially says "there is a folio here, but it's not in an ordinary present > > page table entry. > > > > So we could change that to something better. > > Yeah but leaf_entry_t encapsulates BOTH swap and non-swap entries. > > So that's nice. > > What do you propose calling non-swap leaf entries? It starts spiralling down a > bit there. You don't even ask that question. You have a leaf entry. It has a type. What you are calling a "swap entry" is a "leaf entry of swap type". The union helps encode in the type system what code is operating on what type of the leaf entry. It seems pretty simple. > And it's really common to have logic asserting it's actually a swap entry > vs. not etc. leafent_is_swap(ent) - meaning is a "leaf entry of swap type". > 1. we keep the non-present terminology as a better way of referring > to non-swap entries. I vastly prefer you leap ahead and start using leaf_entry terminology. We don't need a temporary name we are going to throw away. Jason
On Tue, Oct 28, 2025 at 09:52:44AM -0300, Jason Gunthorpe wrote: > On Mon, Oct 27, 2025 at 04:38:05PM +0000, Lorenzo Stoakes wrote: > > On Mon, Oct 27, 2025 at 05:31:54PM +0100, David Hildenbrand wrote: > > > > > > > > I don't love the union. > > > > > > > > How would we determine what type it is, we'd have to have some > > > > generic_leaf_entry_t type or something to contain the swap type field and then > > > > cast and... is it worth it? > > > > > > > > Intent of non-present was to refer to not-swap swapentry. It's already a > > > > convention that exists, e.g. is_pmd_non_present_folio_entry(). > > > > > > Just noting that this was a recent addition (still not upstream) that > > > essentially says "there is a folio here, but it's not in an ordinary present > > > page table entry. > > > > > > So we could change that to something better. > > > > Yeah but leaf_entry_t encapsulates BOTH swap and non-swap entries. > > > > So that's nice. > > > > What do you propose calling non-swap leaf entries? It starts spiralling down a > > bit there. > > You don't even ask that question. > > You have a leaf entry. It has a type. > > What you are calling a "swap entry" is a "leaf entry of swap type". I think this is pretty well covered in the other thread tbh. > > The union helps encode in the type system what code is operating on > what type of the leaf entry. > > It seems pretty simple. As Gregory says, this requires reworking a lot of code. We at the very least need to defer this, and I remain unconvinced it's really worth it. So yeah, let's come back to this later. > > > And it's really common to have logic asserting it's actually a swap entry > > vs. not etc. > > leafent_is_swap(ent) - meaning is a "leaf entry of swap type". I mean, we already have a function that does this in this series with a different name :) But sure I'll rename it to this so we're good. > > > 1. we keep the non-present terminology as a better way of referring > > to non-swap entries. > > I vastly prefer you leap ahead and start using leaf_entry > terminology. We don't need a temporary name we are going to throw > away. Right well we agree on the other series to use the leafent_xxx() prefix so lets' do that. > > Jason Cheers, Lorenzo
On Tue, Oct 28, 2025 at 09:52:44AM -0300, Jason Gunthorpe wrote: > On Mon, Oct 27, 2025 at 04:38:05PM +0000, Lorenzo Stoakes wrote: > > The union helps encode in the type system what code is operating on > what type of the leaf entry. > > It seems pretty simple. > My recommendation of a union was a joke and is anything but simple. Switching to a union now means every current toucher of a swp_entry_t needs functions to do conversions to/from that thing as it gets passed around to various subsystems. It increases overall complexity for no value, i.e. "for negative value". Please do not do this, I regret making the joke. Regards, Gregory
On Tue, Oct 28, 2025 at 09:09:01AM -0400, Gregory Price wrote: > On Tue, Oct 28, 2025 at 09:52:44AM -0300, Jason Gunthorpe wrote: > > On Mon, Oct 27, 2025 at 04:38:05PM +0000, Lorenzo Stoakes wrote: > > > > The union helps encode in the type system what code is operating on > > what type of the leaf entry. > > > > It seems pretty simple. > > > > My recommendation of a union was a joke and is anything but simple. > > Switching to a union now means every current toucher of a swp_entry_t > needs functions to do conversions to/from that thing as it gets passed > around to various subsystems. It increases overall complexity for no > value, i.e. "for negative value". This is the point I was trying to make yes. > > Please do not do this, I regret making the joke. Never joke on list is the lesson here :) I have had to learn that the hard way myself... > > Regards, > Gregory Cheers, Lorenzo
On Mon, Oct 27, 2025 at 04:38:05PM +0000, Lorenzo Stoakes wrote: > Yeah but leaf_entry_t encapsulates BOTH swap and non-swap entries. > > So that's nice. > > What do you propose calling non-swap leaf entries? It starts spiralling down a > bit there. Absent?
On 27.10.25 17:11, Jason Gunthorpe wrote:
> On Fri, Oct 24, 2025 at 04:37:18PM -0400, Gregory Price wrote:
>> On Fri, Oct 24, 2025 at 09:15:59PM +0100, Lorenzo Stoakes wrote:
>>> On Fri, Oct 24, 2025 at 03:12:08PM -0400, Gregory Price wrote:
>>>
>>> So maybe actually that isn't too bad of an idea...
>>>
>>> Could also be
>>>
>>> nonpresent_or_swap_t but that's kinda icky...
>>
>> clearly we need:
>>
>> union {
>> swp_entry_t swap;
>> nonpresent_entry_t np;
>> pony_entry_t pony;
>> plum_emtry_t beer;
>> } leaf_entry_t;
>>
>> with
>>
>> leaf_type whats_that_pte(leaf_entry_t);
>
> I think if you are going to try to rename swp_entry_t that is a pretty
> good idea. Maybe swleaf_entry_t to pace emphasis that it is not used
> by the HW page table walker would be a good compromise to the ugly
> 'non-present entry' term.
Something like that would work for me.
--
Cheers
David / dhildenb
On Fri, Oct 24, 2025 at 04:37:18PM -0400, Gregory Price wrote:
> On Fri, Oct 24, 2025 at 09:15:59PM +0100, Lorenzo Stoakes wrote:
> > On Fri, Oct 24, 2025 at 03:12:08PM -0400, Gregory Price wrote:
> >
> > So maybe actually that isn't too bad of an idea...
> >
> > Could also be
> >
> > nonpresent_or_swap_t but that's kinda icky...
>
> clearly we need:
>
> union {
> swp_entry_t swap;
> nonpresent_entry_t np;
> pony_entry_t pony;
> plum_emtry_t beer;
> } leaf_entry_t;
>
> with
>
> leaf_type whats_that_pte(leaf_entry_t);
>
> with 20 more new functions about how to manage leaf_entries ;]
:))))
Hm well the union is an amusing thought but more seriously leaf_entry_t
seems pretty good name-wise actually :)
>
> no not seriously, please have a good weekend!
Thanks :) Hope you had a good one too!
>
> and thanks again for doing this!
Thanks again :)
> ~Gregory
Cheers, Lorenzo
© 2016 - 2026 Red Hat, Inc.