2 ms·
I'm x86 centric, but the MMU doesn't make decisions about which pages to evict; it just handles mapping virtual addresses to physical addresses based on the pag
by toast0 6y ago
I'm x86 centric, but the MMU doesn't make decisions about which pages to evict; it just handles mapping virtual addresses to physical addresses based on the page table, and marking pages in the page table as dirty/accessed.
The OS would need to manage priority information to evict lower priority pages. That may be part of what's done with posix_fadvise information, but I haven't dug deeply into that.
With this mutli-generational LRU, you could probably add a memory priority to a process, and use that to decide which generation to put pages in when a process needs them. If a low (memory) priority process's pages always go in the oldest generation, they would get considered for reclaim much more often than a high priority process whose pages get put in the youngest generation.
- KMag 6y agoI know the MMU doesn't make eviction decisions, but it does mark the "dirty" and "accessed" bits for pages. The GP was suggesting keeping track of the scheduling priorities of tasks that were "accessing its[the page's] contents", not just keeping track of the highest priority task mapping a given page. This would require the MMU, as it's setting the dirty and accessed bits, to also keep track of the maximum priority that has set either the dirty or accessed bit. Edit: from the GP's reply, it sounds like by "accessing" they really just meant mapping, not accessing is the sense of the accessed and dirty bits.
- johncolanduoni 6y agoThe dirty and accessed bits are per page table structure, so they are per-process. So you can at least take process priority into account, if not thread. In theory you could take thread priority into account by observing and resetting the dirty/accessed bits every context switch, but this would be unlikely to be worth it.
- toast0 6y ago> In theory you could take thread priority into account by observing and resetting the dirty/accessed bits every context switch, but this would be unlikely to be worth it. That would be most likely terrible (as you suggest). You might have better luck giving each thread a copy of the process page table, and keeping that in sync somehow (which also sounds terrible, but might be more workable)