[ccache] [RFC PATCH] Use fast (copy-on-write) copies on btrfs

Tobias Geerinckx-Rice tobias.geerinckx.rice at gmail.com
Wed Sep 17 11:24:14 MDT 2014


Egon Alter wrote:

> I did some measurements compiling the openSUSE kernel:


> git clean, dropped caches
> no ccache:         5391.75user 639.29system 31:26.27elapsed 319%CPU
> with ccache:        887.53user 289.11system 15:07.42elapsed 129%CPU
> with ccache + cow:  933.62user 318.38system 18:56.00elapsed 110%CPU
> So surprisingly, ccache + cow is slower than without cow.

Uh oh.

> I can only guess
> that the compilation is IO limited in both cases and that using reflink
> instead of copy doesn't reduce it significantly for some reason (many small
> files maybe?). The filesystem was using compression (lzo) btw.

Hrm... btrfs's compression can sometimes interfere with other features
like (no)cow, so I gave in and ran some quick & dirty tests.

Set-up: compiling ccache with itself seemed fitting, finishes in
finite time on an old netbook, and produces a handful of nice >4 KiB
object files that can't be inlined.

Result: unless 'filefrag -v' is lying or btrfs silently ignores a
'remount,compress={none,lzo}' (and mind you: both are always possible
with a fledgling file system), CoW works flawlessly here in both
cases, and in both directions. Not a single extent is duplicated once
the initial object file has been compiled.

Oh: and it's consistently slower.



More information about the ccache mailing list