Re: 'cp file1 file2' takes 2x`sizeof(file)` cache (2.3.99-pre9-2)

From: Andreas Bombe (andreas.bombe@munich.netsurf.de)
Date: Wed May 17 2000 - 15:34:45 EDT

  • Next message: Jeff Garzik: "Re: 'cp file1 file2' takes 2x`sizeof(file)` cache (2.3.99-pre9-2)"

    On Tue, May 16, 2000 at 11:57:25PM +0200, iafilius@xs4all.nl wrote:
    > Just noticed while copying a (large/tested with 60MB) file it takes about
    > twice the file's size in cache (which takes it from free memory).
    >
    > This must be because kernel doesn't know about the same files,
    > and caches them separate.

    They are separate files after all, so what should it do? Do a memcmp
    over all of its caches to find whether there are identical cache
    pages?

    > But it _is_ waste of memory isn't ?

    There were proposals for interfaces so that applications can give
    hints to the kernel on how they use the files to let the kernel make
    better decisions on caching. I don't know what of that is already
    working somewhere.

    And those hints could always make it worse. Take your copy for
    example: cp tells the kernel it will only stream write the other file,
    then the kernel makes no effort to keep the written pages in RAM.
    Immediately after cp terminates another process accesses the copied
    file, which now has to be read in again even though it was there a few
    milliseconds earlier anyway.

    -- 
     Andreas E. Bombe <andreas.bombe@munich.netsurf.de>    DSA key 0x04880A44
    http://home.pages.de/~andreas.bombe/    http://linux1394.sourceforge.net/
    

    - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Wed May 17 2000 - 16:00:06 EDT