Hi,

looking into the pool code we realized that pool_sethardlimit
does some extra work that it's not supposed to do.  essentially
pool_sethardlimit is there so that we can set a maximum number
of entries pool_get can give away.  though currently it doesn't
do only that.  it also sets a limit on how many empty pages pool
should keep around available for further allocations.  and that's
precisely what pool_sethiwat is all about.

the problem is that it sets those limits to the same value, which
in case of large pools (as cluster pool) can end up with 3000
pages or more.

there are situations when you need to keep around more pages than
the default (which is 8 btw), but surely this isn't the same as
a possible maximum of entries pool can give away.  these pools
can call pool_sethiwat directly and set appropriate limits
themselves (and they do actually).

ok to commit?

currently there are a bunch of pools that do pool_sethardlimit,
so please take time and verify that pool_sethardlimit usage there
doesn't imply pool_sethiwat (mclpools are taken care of):

./net/pf_ioctl.c:       pool_sethardlimit(pf_pool_limits[PF_LIMIT_STATES].pp,
./net/pf_ioctl.c:                           
pool_sethardlimit(pf_pool_limits[i].pp,
./net/pf_norm.c:        pool_sethardlimit(&pf_frent_pl, PFFRAG_FRENT_HIWAT, 
NULL, 0);
./net/pf_norm.c:        pool_sethardlimit(&pf_cache_pl, PFFRAG_FRCACHE_HIWAT, 
NULL, 0);
./net/pf_norm.c:        pool_sethardlimit(&pf_cent_pl, PFFRAG_FRCENT_HIWAT, 
NULL, 0);
./netinet/tcp_subr.c:   pool_sethardlimit(&tcpqe_pool, tcp_reass_limit, NULL, 
0);
./netinet/tcp_subr.c:   pool_sethardlimit(&sackhl_pool, tcp_sackhole_limit, 
NULL, 0);
./netinet/tcp_usrreq.c:                 error = pool_sethardlimit(&tcpqe_pool, 
nval, NULL, 0);
./netinet/tcp_usrreq.c:                 error = pool_sethardlimit(&sackhl_pool, 
nval, NULL, 0);

Index: kern/subr_pool.c
===================================================================
RCS file: /home/cvs/src/sys/kern/subr_pool.c,v
retrieving revision 1.98
diff -u -p -r1.98 subr_pool.c
--- kern/subr_pool.c    26 Sep 2010 21:03:57 -0000      1.98
+++ kern/subr_pool.c    3 Nov 2010 14:58:15 -0000
@@ -993,13 +1026,6 @@ pool_sethardlimit(struct pool *pp, u_int
        pp->pr_hardlimit_ratecap.tv_sec = ratecap;
        pp->pr_hardlimit_warning_last.tv_sec = 0;
        pp->pr_hardlimit_warning_last.tv_usec = 0;
-
-       /*
-        * In-line version of pool_sethiwat().
-        */
-       pp->pr_maxpages = (n == 0 || n == UINT_MAX)
-               ? n
-               : roundup(n, pp->pr_itemsperpage) / pp->pr_itemsperpage;
 
 done:
        return (error);

Reply via email to