lkml.org 
[lkml]   [2021]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v1] mm: Add /proc/$PID/pageflags
On Tue, Nov 2, 2021 at 4:42 AM David Hildenbrand <david@redhat.com> wrote:
>
> >> Bit 58-60 are still free, no? Bit 57 was recently added for uffd-wp
> >> purposes I think.
> >>
> >> #define PM_SOFT_DIRTY BIT_ULL(55)
> >> #define PM_MMAP_EXCLUSIVE BIT_ULL(56)
> >> #define PM_UFFD_WP BIT_ULL(57)
> >> #define PM_FILE BIT_ULL(61)
> >> #define PM_SWAP BIT_ULL(62)
> >> #define PM_PRESENT BIT_ULL(63)
> >>
> >> PM_MMAP_EXCLUSIVE and PM_FILE already go into the direction of "what is
> >> mapped" IMHO. So just a thought if something in there (PM_HUGE? PM_THP?)
> >> ... could make sense.
> >>
> >
> > Thanks! I _think_ that would work for us, I'll look into confirming.
> > To be honest I still wonder if eventually different folks will find
> > uses for other page flags and eventually we'll run out of pagemaps
> > bits, but I'll yield to whatever you think is best here.
>
> Using one of the remaining 3 bits should be fine. In the worst case,
> we'll need pagemap_ext at some point that provides more bits per PFN, if
> we ever run out of bits.
>

That sounds great to me. Thank you Both Matthew and David for
patiently explaining the concerns with /proc/self/pageflags to me and
suggesting alternatives that could work :-)

> But as mentioned by Matthew, extending mincore() could also work: not
> only indicating if the page is resident, but also in which "form" it is
> resident.
>

I need to learn more about mincore() to be honest, from casually
reading some docs I didn't get a full understanding on if/why that
would work better. I'll do some investigating and upload V2 either
with /proc/self/pagemaps or mincore() and why I chose such and we can
go from there.

> We could separate the cases "cont PTE huge page" vs. "PMD huge page".
>

So to be completely honest (and I need to confirm), we are using this
on x86 and we essentially care that the virt address is mapped by 2MB,
so mapped by PMD. I think (but need to confirm) that's what the
pageflags HUGE bit refers to as well as does PageHuge() and
TransPageHuge(). After confirming I'll upload V2 with the precise info
we need (I think it's going to be "PMD huge page" as David says).

> I recall that the information (THP / !THP) might be valuable for users:
> there was a discussion to let user space decide where to place THP.
> (IIRC madvise() extension to have something like MADV_COLLAPSE_THP /
> MADV_DISSOLVE_THP)
>
> --
> Thanks,
>
> David / dhildenb
>

\
 
 \ /
  Last update: 2021-11-02 19:42    [W:0.080 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site