Subject: Re: Kernel Compile (v1.6.2) - can't increase max file descriptors?
To: None <tech-userlevel@netbsd.org>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-userlevel
Date: 01/26/2005 02:10:20
In article <200501251517.j0PFHwei007750@sdf.lonestar.org>,
	Gene ENonymous <yancm@sdf.lonestar.org> writes:
> I've been doing some minor hacking on my i386 v1.6.2 (stable) kernel.
> My machine is a P166 w/80M ram.
> 
> I needed more memory for ipf, so in my kernel config I increased
> NKMEMPAGES (OK I doubled it...) per the kernel config segment below.

NKMEMPAGES=16392 seems excessive.  That means the kernel could use up
to 64MB, more than half of your RAM, and if it were to actually do that,
your applications would swap mightily.  Chances are, you're not doing
anything that uses that much, so the only downside is, you're giving
up a few K for the excessively large kernel map.  Symptoms of kernel
malloc() failing include device drivers failing to load, and being
unable to start new shells.  So, why do you think you need so much?
 
> After I did this I tried to run the tor server which requests
> 1024 file descriptors and now it crashed saying it could only get 956? 
>
> I then looked at the Options page and it seemed intuitive enough to 
> increase NOFILE which I also did. But this had no effect...my limit
> is still 956 descriptors. I have also pulled relevent info from the sysctl -a
> dump below.

NOFILE only increase the default soft limit. The calculation of
the hard limit is based on "maxusers". The formula works out to be
"(51 * maxusers) + 140", therefore, I infer that your maxusers must
be "16". Try doubling *that*.
 
> Can anyone give me hints? (should I use a different mailing list?)

Probably. I would suggest netbsd-help.  tech-userlevel is for
discussing changes to the userland programs, so this thread seems
to be wildly off-topic here.
 

Frederick