Subject: Re: loaning for read() of regular files
To: Jonathan Stone <jonathan@dsg.stanford.edu>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 02/23/2005 09:21:14
On Wed, Feb 23, 2005 at 09:11:02AM -0800, Jonathan Stone wrote:
> >> Also: I assume it's benign, but have you to confirmed by testing that
> >> read()ing through files much larger than physical memory isn't
> >> penalized by the changes for loanout?
> >
> >my initial mail gave results for reading a file that wasn't already
> >in the cache, which is basically the same as what you're talking about.
> >
> >but I ran your case just now anyway, reading through 2GB of a file
> >on a machine with 512MB of RAM, using the same two buffer sizes as
> >before (4KB and 1MB):
> 
> ... the numbers are a wash (loanout has about a 0.5% win.) Great.

the win is in CPU time, not real time.  loaning uses much less CPU
than copying.


> I thought about this more last night. What about an app which writes
> into each loaned-out page? Do we take a copy-on-write fault for each
> such page?

yes.

> What do the numbers look like then --- that is, is the
> penalty bad enough that it's worth adding a per-fd flag to disable
> loanout, for apps which intend to dirty their just-read() pages?

I haven't done the experiment, I'll do it soon.

-Chuck