- Correct the needed headers
- Make the existing example ANSI C. Don't reference a real kernel function whose implementation has changed, it is simple enough to use foo and bar as identifiers
- Add a little bit of introductory text
- Document the widely used MPASS macro in this page
- Drop the cross-reference to config(8)
I think this is a bit unclear: certain non-recoverable errors are handled with an explicit call to panic() since they apply to non-INVARIANTS kernels as well. Maybe it should be more obvious that KASSERT() is optional and only enabled in debugging kernels.
Traditionally we use options DIAGNOSTIC for really expensive checks (and in some old code it's used to enable some miscellaneous debug printf()s, but I think that's discouraged now). Maybe it'd be worth mentioning that?
Maybe one way to express this is that assertion conditions should be checkable in constant time. INVARIANTS kernels are allowed to be slow, but they must still be "usable" in some sense.
I always thought that it was "multi-processor assert" but that doesn't make a ton of sense (maybe it was introduced during the transition to MPSAFE kernels?) and I have no proof. Your name is better.
Something should be said that the panic string is formed by sprintf-ing format and args.
This is in fact the worst example of assert. The normal approach for NULL deref checks is to left it to the MMU. Note that we do not have many a != NULL asserts in kernel. bde@ objected esp. loud against them.