tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Protecting global lookup array

I'm adding another list of vm_physseg for device pages.  It's a list or array
of physical address segments.  They're frequently accessed by VM to lookup
a physical address from a page metadata (vm_page) or vice versa.

Those lists are rarely updated.  When a framebuffer or memory-mappable audio
device are attached / detached.  (For RAM segments, they're updated when we'll
support memory hot-plug. :)

The update process is very rare, and expected.  Administrators carefully
connects a device when the machine is not running some important task.  So
what I need here is to protect such a data adding no run-time performance

Do we have any standard way to do this?

If not, what I'm thinking is like:

- a sub-system queries the kernel if it's a good time to do this
- if yes, pass a call-back and data
- the kernel asks all other CPUs to stop tasks and wait in some safe code point
- other CPUs tells back that they're waiting
- if all CPUs have stopped, the kernel runs the passed callback & data
- in the callback, update array

Protected data should be an array of pointers to objects, not an array of
objects, so that already referenced objects are not affected by the lookup


Home | Main Index | Thread Index | Old Index