svn commit: r217830 - head/share/man/man9
Robert N. M. Watson
rwatson at freebsd.org
Thu Jan 27 12:04:12 UTC 2011
On 26 Jan 2011, at 23:41, mdf at FreeBSD.org wrote:
> Upon further consideration, I don't think sbuf_new_for_sysctl() should
> be doing the wire. Whether the buffer needs to be wired or not is up
> to the implementation of the individual sysctl; *most* of them will be
> holding a lock when doing sbuf_print, but there's no guarantee. It's
> simpler to just leave this in the hands of the implementor, and it
> also enables better error reporting.
One pondering: normally, it's nice if functions that may sleep unconditionally trigger a WITNESS sleep warning even if they don't actually sleep this time (although conditioned on arguments: if you pass M_WAITOK to malloc, you always get the warning even if malloc doesn't sleep, whereas if you pass M_NOWAIT it doesn't). I'm wondering how we could do something similar here -- the problem is that sysctl copy routines don't currently know if a page is wired or not, and therefore whether they could sleep or not. I wonder, with a witness kernel, how expensive it would be to have witness check for each range it was copying in/out of, whether the page was wired (by asking VM presumably)... There might also be lock order issues with that query.
One way to handle this would be to have the sbuf sysctl setup pass in a "wired" flag, or some other indication of wiredness, and then that could be saved with the sbuf -- when sbuf_printf and friends are called, and a non-wired sysctl has been set up, then the witness warning fires.
More information about the svn-src-head