From owner-freebsd-current Wed Mar 7 11:10:16 2001 Delivered-To: freebsd-current@freebsd.org Received: from earth.backplane.com (earth-nat-cw.backplane.com [208.161.114.67]) by hub.freebsd.org (Postfix) with ESMTP id EFD3337B71A; Wed, 7 Mar 2001 11:10:13 -0800 (PST) (envelope-from dillon@earth.backplane.com) Received: (from dillon@localhost) by earth.backplane.com (8.11.2/8.9.3) id f27J9tp71792; Wed, 7 Mar 2001 11:09:55 -0800 (PST) (envelope-from dillon) Date: Wed, 7 Mar 2001 11:09:55 -0800 (PST) From: Matt Dillon Message-Id: <200103071909.f27J9tp71792@earth.backplane.com> To: Mark Murray Cc: Bruce Evans , Maxim Sobolev , dougb@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: harvest_interrupt=YES slows down machine References: <200103071732.f27HWou70340@earth.backplane.com> <200103071840.f27IetR60520@gratis.grondar.za> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG :> I think it would be a much better idea to cap the number of interrupts :> per second the reseeder accepts. e.g. have a sysctl to set the :> max and default it to something reasonable, like 200. The seeder would :> thus only run 200 times a second even if A person were getting :> 7750 interrupts/sec. Frankly, once we have a good random seed it would :> only take about 10 interrupts a second to keep the random number :> generator in good shape, and possibly even less. Overkill is not :> necessary. : :This effectively happens. : :The harvest ring is a limited length, and any overflows are discarded. : :M The harvest ring is *HUGE* -- the ring is 1024 entries. Obviously it does not have a problem keeping up with a high interrupt rate. Also, my read of the thread that eats the data off that ring is that the thread pulls everything off the ring in a tight loop, which means that the ring will effectively be empty most of the time no matter how much data gets stuffed into it. So the 'limited length', even a small limited length, does not effectively limit the amount of work being done by the interrupt code. You need to do two things: 1) Reduce the ring size to something reasonable. 1024 is massive overkill. 32 would be just fine. 2) Add a mandatory tsleep in random_kthread() for EACH entry scanned from the harvest ring. Something reasonable like 1/10 second (similar to what you do if the harvest ring is empty. Or may you could pull off 5 entries at a time and then sleep. Right now you run it in a tight loop until the ring is completely empty. A 1/10 second sleep and a ring limit of 32 still gives you an effective 320 seeds per second. Still overkill, but at least not the massive overkill that its doing now. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message