Page MenuHomeFreeBSD

kstack: Fix iterator usage in vm_thread_stack_create()
AcceptedPublic

Authored by markj on Wed, Oct 8, 2:03 PM.
Tags
None
Referenced Files
F131542688: D52982.id.diff
Thu, Oct 9, 2:42 AM
F131533853: D52982.id163777.diff
Thu, Oct 9, 12:43 AM
F131502593: D52982.diff
Wed, Oct 8, 4:52 PM
F131497932: D52982.id163777.diff
Wed, Oct 8, 3:39 PM
F131497546: D52982.id.diff
Wed, Oct 8, 3:34 PM
F131495786: D52982.diff
Wed, Oct 8, 3:08 PM
Subscribers

Details

Summary

After commit 7a79d0669761 we no longer hold the VM object lock when
initializing or advancing the domainset iterator in
vm_thread_stack_create().

We could lift the lock out of vm_thread_stack_back() but that poses
complications since we cannot allocate KVA with a VM object lock held.

Instead of overridding the object's iterator, just borrow that of the
current thread. Kernel stacks are basically always allocated with a
DOMAINSET_POLICY_PREFER policy, so it's not very important to maintain a
global iterator for round-robin allocation.

As a part of this, fix up flag handling: make sure we handle
M_NOWAIT/M_WAITOK from the caller. Delete a comment in vm_thread_new()
which refers to a non-existent consideration (stack swapping has been
removed). I suspect vm_thread_new() can use M_WAITOK but opted not to
make that change here.

Fixes: 7a79d0669761 ("vm: improve kstack_object pindex calculation to avoid pindex holes")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 67646
Build 64529: arc lint + arc unit