public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Xymoron <oxymoron@waste.org>
To: Andrew Morton <akpm@digeo.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: the random driver
Date: Wed, 20 Nov 2002 14:42:32 -0600	[thread overview]
Message-ID: <20021120204232.GG622@waste.org> (raw)
In-Reply-To: <3DDB3DED.A4C9DC56@digeo.com>

On Tue, Nov 19, 2002 at 11:46:53PM -0800, Andrew Morton wrote:
> 
> I'm seeing a context switch rate of 150/sec just writing a
> big file to disk at 20 megabytes/sec.
> 
> It is coming out of add_disk_randomness()'s invokation of
> batch_entropy_store().

First off, there's very little unobservable randomness in those disk
ops, especially in a file/webserver context, so the value of
add_disk_randomness is questionable.
 
> That function is setting up deferred punt-to-process-context
> for every disk request, and has the potential to cause 1000
> context switches per second.  This is clearly excessive.
> 
> There is a 256 slot buffer in the random driver for this,
> and we are not using it at all effectively.  I do intend
> to submit the below patch which will cause one context switch
> per 128 requests.

Done that.

> But this is a minimal fix.  The batch_entropy_pool handling
> in there needs work.
> 
> a) It's racy.  The head and tail pointers have no SMP protection
>    and a race will cause it to dump 128 already-processed items
>    back into the entropy pool.

I have a rewrite that fails safe and is lockless. But this is nothing
compared to the completely broken entropy accounting in
xfer_secondary_pool. Try this: cat /dev/random, wait for it to block,
and then tap your mouse.

> d) It's punting work up to process context which could be performed
>    right there in interrupt context.

Disagree. Did you look at the mixing function? It'll dirty a large
chunk of cache.

-- 
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 

      parent reply	other threads:[~2002-11-20 20:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-20  7:46 the random driver Andrew Morton
2002-11-20  8:13 ` Aaron Lehmann
2002-11-20 20:44   ` Oliver Xymoron
2002-11-20 12:04 ` Ingo Oeser
2002-11-20 16:27 ` Theodore Ts'o
2002-11-20 19:35   ` Andrew Morton
2002-11-20 20:42 ` Oliver Xymoron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021120204232.GG622@waste.org \
    --to=oxymoron@waste.org \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox