linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Page zapping and page table reclaim
@ 2021-03-11 18:14 David Hildenbrand
  2021-03-11 21:26 ` Peter Xu
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: David Hildenbrand @ 2021-03-11 18:14 UTC (permalink / raw)
  To: Linux Memory Management List
  Cc: Minchan Kim, Matthew Wilcox, Rik van Riel, Michal Hocko,
	Andrea Arcangeli, Peter Xu

Hi folks,

I was wondering, is there any mechanism that reclaims basically empty 
page tables in a running process?

Like: When I MADV_DONTNEED a huge range, there could be plenty of 
basically empty (e.g., all entries invalid) page tables we could 
reclaim. As soon as we zap a complete PMD we could reclaim (depending on 
the architecture) a whole page.

Zapping on the PMD level might make most impact I guess.

For 1 GB, we need 262144 4k pages. If we assume each PTE is 8 bytes, we 
need a total of 8 MB for the lowest level page tables (PTE).

OTOH, we would need 512 PMD entries - a single 4k page. Zapping 1 TB 
would mean we can free up another 4MB - rather a corner case and we can 
live with that.


Of course, the same might apply to other cases where we can restore all 
page table content from the VMA again. One example would be after 
MADV_FREE zapped a whole range of entries we marked.

Looks like if we happen to zap a THP, we should already get what we want 
(no page table, nothing to remove)

I haven't immediately stumbled over anything, but could be I am missing 
the obvious. I guess what would need some thought is concurrent 
discards/pagefaults - but it feels like being similar to 
collapsing/splitting a THP while there is other system activity.

Maybe there is already something and I am just not aware of it.

Thanks!

-- 
Thanks,

David / dhildenb



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

end of thread, other threads:[~2021-03-24  9:55 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 18:14 Page zapping and page table reclaim David Hildenbrand
2021-03-11 21:26 ` Peter Xu
2021-03-11 21:35   ` David Hildenbrand
2021-03-19 17:04     ` Yang Shi
2021-03-22  9:34       ` David Hildenbrand
2021-03-18 16:57 ` Vlastimil Babka
2021-03-18 23:53   ` Balbir Singh
2021-03-19 12:44     ` David Hildenbrand
2021-03-20  1:56       ` Balbir Singh
2021-03-22  9:19         ` David Hildenbrand
2021-03-18 18:03 ` Rik van Riel
2021-03-18 18:15   ` David Hildenbrand
2021-03-24  9:55 ` David Hildenbrand

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