Page MenuHomeFreeBSD

Simplify vm_pageout_init_domain() and add a "big picture" comment.
ClosedPublic

Authored by markj on Nov 15 2019, 11:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 3, 3:56 PM
Unknown Object (File)
Feb 27 2024, 7:21 AM
Unknown Object (File)
Dec 22 2023, 11:22 PM
Unknown Object (File)
Nov 15 2023, 9:15 AM
Unknown Object (File)
Nov 10 2023, 10:21 PM
Unknown Object (File)
Nov 7 2023, 2:57 PM
Unknown Object (File)
Nov 5 2023, 11:05 AM
Unknown Object (File)
Nov 4 2023, 3:59 AM
Subscribers

Details

Summary

Stop subtracting 1024/200 from vmd_page_count/200. I cannot see how
such precise accounting can make a difference on modern systems.

Add some explanation of what the page daemon does and how it handles
memory shortages. I think this will serve as a useful reference as we
continue to make changes to the system.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27631
Build 25838: arc lint + arc unit

Event Timeline

I can't comment on the accuracy of any of this, but I can channel my 9th grade English teacher, Mrs. Weaver. There's some more passive voice in there (is awakened? by who?), but you're probably more interested in technical feedback.

sys/vm/vm_pagequeue.h
102

Passive voice. A page daemon manages each vm_domain structure ....

133

parens around the expression would improve readability. Either that, or commas.

141

Passive voice. Who awakens it?

154

are thus eventually migrated -> thus eventually migrate

157

will periodically launder -> periodically launders

161

will attempt -> attempts

sys/vm/vm_pagequeue.h
102

'a page daemon thread'

103

... is available, by free some inactive pages and demoting active to inactive, as needed.
To decide how many pages to proceed, it makes use of the ...

168

I think that 'typically' can be removed, pmaps kernel page table pages allocators are the only users of VM_ALLOC_INTERRUPT in the current code.

169

'some cases' sounds somewhat optimistic there

171

I do not think that the statement 'most kernel memory allocations' for VM_ALLOC_SYSTEM is true. In fact it is reverse, most mallocs result in VM_ALLOC_NORMAL page requests, from my understanding. Indeed, internal UMA things or buffer cache, or mallocs with M_USE_RESERVE are about _SYSTEM.

184

if the allocating thread cannot fail the allocation, it calls vm_wait()

202

s/creation/population/ ?

213

page daemon thread

sys/vm/vm_pageout.c
2123–2124

I would guess that a 4MB system would not even boot right now. So whoever wants to use one will have to do some hacking. On the other hand, keeping a MIN(calc, 4) is not much burden.

sys/vm/vm_pagequeue.h
109

I might like a bulleted list at one more level of indent for every target with a bulleted list of what it governs, what event handlers may be called, threads woken, that sort of thing.

The text below should be only for more complicated relationships that don't fit within the bullets and may be used by new people to familiarize themselves. I suspect all of us would get more value by scanning a briefer list.

sys/vm/vm_pagequeue.h
109

Are you suggesting both paring down the text below and summarizing it here, or just the latter?

markj marked 12 inline comments as done.Nov 19 2019, 1:37 AM

I can't comment on the accuracy of any of this, but I can channel my 9th grade English teacher, Mrs. Weaver. There's some more passive voice in there (is awakened? by who?), but you're probably more interested in technical feedback.

I blame French immersion for my bad writing habits.

I tried to fix all uses of the passive voice but would appreciate any further suggestions to make the text clearer.

sys/vm/vm_pagequeue.h
169

There are indeed some cases where it is handled, or at least we try to do so. For instance if a large mapping in the direct map is demoted, we need to allocate a leaf PTP, and callers of pmap_demote_*() must handle failure.

171

malloc() always uses _SYSTEM or _INTERRUPT: malloc2vm_flags() contains:

pflags = (malloc_flags & M_USE_RESERVE) != 0 ? VM_ALLOC_INTERRUPT :                                                                                                   
    VM_ALLOC_SYSTEM;

This was somewhat surprising to me, I also thought it used _NORMAL.

Hopefully address all of the feedback.

This revision is now accepted and ready to land.Nov 19 2019, 5:13 PM