Re: Unexpected splice "always copy" behavior observed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 19, 2010 at 08:30:10AM -0700, Linus Torvalds wrote:
> 
> 
> On Thu, 20 May 2010, Nick Piggin wrote:
> > 
> > Well I mean a full invalidate -- invalidate_mapping_pages -- so there is
> > literally no pagecache there at all.
> 
> Umm. That won't work. Think mapped pages. You can't handle them 
> atomically, so somebody will page-fault them in.
> 
> So you'd have to have a "invalidate_and_replace()" to do it atomically 
> while holding the mapping spinlock or something. 
> 
> And WHAT IS THE POINT? That will be about a million times slower than 
> just doing the effing copy in the first place!
> 
> Memory copies are _not_ slow. Not compared to taking locks and doing TLB 
> invalidates.

No I never thought it would be a good idea to try to avoid all races
or anything. Obviously some cases *cannot* be easily invalidated, if
there is a ref on the page or whatever, so the fallback code has to
be there anyway.

So you would just invalidate and try to insert your page. 99.something%
of the time it will work fine. If the insert fails, fall back to
copying.

And hey you *may* even want a heuristic that avoids trying to invalidate
if the page is mapped, due to cost of TLB flushing and faulting etc.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]