linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Can someone explain what free_pgd_range(), etc actually do?
@ 2017-11-03 12:11 Andy Lutomirski
  2017-11-03 15:06 ` Dave Hansen
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Lutomirski @ 2017-11-03 12:11 UTC (permalink / raw)
  To: Dave Hansen, Kirill A. Shutemov, Hugh Dickins, linux-mm@kvack.org; +Cc: X86 ML

I want to reserve a tiny bit of the address space just below 1<<47 on
x86_64 for kernel purposes but without stealing away management of the
page tables.  It seems like the way to do that is to set
USER_PGTABLES_CEILING to 0 and then make some adjustment to
exit_mmap() to free the tables on exit.

The problem is that free_pgd_range(), free_pgtables, etc are quite
opaque to me, and I'm having a hard time understanding the pagetable
freeing code.  Some questions I haven't figured out:

 - What is the intended purpose of addr, end, floor, and ceiling?
What are the pagetable freeing functions actually *supposed* to do?

 - Are there any invariants that, for example, there is never a
pagetable that doesn't have any vmas at all under it?  I can
understand how all the code would be correct if this invariant were to
exist, but I don't see what would preserve it.  But maybe
free_pgd_range(), etc really do preserve it.

 - What keeps mm->mmap pointing to the lowest-addressed vma?  I see
lots of code that seems to assume that you can start at mm->mmap,
follow the vm_next links, and find all vmas, but I can't figure out
why this would work.

 - What happens if a process exits while mm->mmap is NULL?

 - Is there any piece of code that makes it obvious that all the
pagetables are gone by the time the exit_mmap() finishes?

Because I'm staring to wonder whether some weird combination of maps
and unmaps will just leak pagetables, and the code is rather
complicated, subtle, and completely lacking in documentation, and I've
learned to be quite suspicious of such things.

--Andy

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-03 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-03 12:11 Can someone explain what free_pgd_range(), etc actually do? Andy Lutomirski
2017-11-03 15:06 ` Dave Hansen

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).