svn commit: r243631 - in head/sys: kern sys

Alfred Perlstein bright at mu.org
Mon Jan 14 17:16:29 UTC 2013


[[ moved to -arch ]]

On 1/14/13 11:22 AM, Alexander Motin wrote:
> On 14.01.2013 18:05, Andre Oppermann wrote:
>> On 14.01.2013 16:51, Alexander Motin wrote:
>>> As I've actually written, there are two different things:
>>>    ncallout -- number of preallocated callout structures for purposes of
>>> timeout() calls. That is a legacy API that is probably not very much
>>> used now, so that value don't need to be too big. But that allocation is
>>> static and if it will ever be exhausted system will panic. That is why
>>> it was set quite high. The right way now would be to analyze where that
>>> API is still used and estimate the really required number.
>> Can timeout() be emulated on top of another API so we can do away with it?
> It is already emulated on top of callout_init()/callout_reset(). The
> problem is that callout_init()/callout_reset() assume storage memory to
> be allocated by consumer, while timeout() assumes it to be allocated by
> subsystem. The only way to solve it is to rewrite remaining timeout()
> consumers to use callout_init()/callout_reset() API directly.



The following diff should suffice as a fine stop-gap and is no worse 
than what we've lived with for the past 10 years.

What it does is cap the amount of callouts to a function of maxusers as 
if the old limit of 384 was in place.

A more comprehensive fix is not needed because we are about to do away 
with the entire mess anyhow.

I'm doing some testing with it.  Let me know what you think.

-Alfred
-------------- next part --------------
Index: subr_param.c
===================================================================
--- subr_param.c	(revision 245315)
+++ subr_param.c	(working copy)
@@ -324,8 +324,11 @@
 
 	/*
 	 * XXX: Does the callout wheel have to be so big?
+	 *
+	 * Clip callout to result of previous function of maxusers maximum
+	 * 384.  This is still huge, but acceptable.
 	 */
-	ncallout = 16 + maxproc + maxfiles;
+	ncallout = min(16 + maxproc + maxfiles, 18508);
 	TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
 
 	/*


More information about the freebsd-arch mailing list