[lkml]   [2003]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Delaying writes to disk when there's no need
    On Mon, 31 Mar 2003, Andrew Morton wrote:
    > Daniel Pittman <> wrote:
    >> Capturing a real-time video stream from an IEEE1394 DV stream means
    >> writing a stead 3.5MB per second for two on two and a half hours.
    >> Linux isn't great at this, using the default writeout policy, even as
    >> recent as 2.5.64. The writer goes OK for a while but, eventually,
    >> blocks on writeout for long enough to drop a frame -- more than
    >> 8/25ths of a second.
    >> This can be resolved by tuning the default delay before write-out
    >> start to 5 seconds, down from 30, or by running sync every second, or
    >> by doing fsync tricks.
    > Interesting.
    > Yes, I expect that you could fix that up by altering
    > dirty_background_ratio and dirty_expire_centisecs.

    Those are, in fact, the precise knobs I turned. Well, those and the XFS
    pagebuf layer equivalents.

    > The problem with fsync() is that it waits on the writeout. You don't
    > want that to happen - you just want to tell the kernel "I won't be
    > overwriting or deleting this data". Make the kernel queue up and start
    > the IO but not wait on its completion.

    Yes, that would be good, because then I wouldn't need to write an IPC
    thing and fork or thread, so that the second thread can be busy blocking
    on the writeout for me.

    > It is quite appropriate to do this in fadvise(FADV_DONTNEED) - as a
    > lower-latency fsync(). The app would need to call it once per second
    > or so.
    > It would also throw away any written-back pagecache inside your
    > (start, len) which is exactly what your applications wants to happen,
    > so the app should be calling fadvise _anyway_.
    > What do you think?

    I will apply the patch and test later today. This, however, looks like
    a *really* good thing to me.


    there's a party going on
    we'll all be here dancing underground
    there's a riot going on
    we'll all be here dancing underground
    -- Covenant, _Riot_
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:34    [W:0.045 / U:151.440 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site