[Openmcl-devel] FINISH-OUTPUT/fsync slowness

R. Matthew Emerson rme at clozure.com
Sat Nov 8 10:59:21 PST 2014


On Nov 8, 2014, at 11:27 AM, Waldek Hebisch <hebisch at math.uni.wroc.pl> wrote:

> Trying FriCAS with recent Closure CL on recent Linux I got
> wery long compile time.  More precisely, real time was
> quite long while CPU time was OK.  The reason was disc
> activity.  FriCAS was using FINISH-OUTPUT which in Closure CL
> seem to cause call to fsync.  Now, apparently in recent Linux
> fsync is doing what it should do and flushes disc write cache...
> 
> I have worked around the problem by removing most calls to
> FINISH-OUTPUT and replacing a few critical ones with FORCE-OUTPUT.
> IMHO decision to call fsync from FINISH-OUTPUT is unfortunate.
> ANSI wording for FORCE-OUTPUT say that it merely starts writing
> out buffer but do not wait for write to finish.  In particular
> FORCE-OUTPUT is allowed to use asynchronous I/O.  Which
> means that when Lisp program wants to pass data in a file
> to another program it should call FINISH-OUTPUT as FORCE-OUTPUT
> may be still doing its work at time when another program wants
> to read the data.

CCL has called fsync on finish-output for a long time (10+ years).  Some years ago, there was a lot of discussion about how expensive fsync was on ext3 filesystems;  I don't know what the current state of things is.

The spec says, "finish-output attempts to ensure that any buffered output sent to output-stream has reached its destination, and then returns."  That sounds a lot like fsync to me.







More information about the Openmcl-devel mailing list