Re: Lockless file reading

From: Jamie Lokier (jamie_at_shareable.org)
Date: 08/28/03

  • Next message: Ricky Beam: "/proc/net/* read drops data (was: lost socket)"
    Date:	Thu, 28 Aug 2003 01:03:21 +0100
    To: "Richard B. Johnson" <root@chaos.analogic.com>
    
    

    Richard B. Johnson wrote:
    > Let's see if it is possible for the middle byte of
    > a 3-byte sequence to not be written when both
    > other bytes are written:

    > Even in machines that do load/store operations where individual
    > components of those stores happen in groups, access to/from
    > a buffer of such data is controlled (by hardware) so a write
    > will complete before a read occurs.

    I don't understand what you mean by this.

    Do you mean that the writes are forced to appear on a different CPU in
    the same order that they were written? That isn't true on x86, for
    two reasons: 1. writes aren't always in processor order (see
    CONFIG_X86_OOSTORE and CONFIG_X86_PPRO_FENCE); 2. reads on the other
    processor are out of order anyway.

    > With hardware that can perform byte-access (ix86), the only
    > byte-access that is going to happen is at the end(s) of buffers.

    Not true. Take a look at __copy_user() in arch/i386/lib/usercopy.c.
    The first few bytes are copied using "rep;movsb", which is not
    guaranteed to use a word write for the aligned pair, nor is it
    guaranteed a particular timing (there could be an interrupt between
    each byte).

    Other architectures are similar.

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


  • Next message: Ricky Beam: "/proc/net/* read drops data (was: lost socket)"

    Relevant Pages

    • Re: [PATCH] speed up SATA
      ... write-cache-off queueing will be slightly slower than ... since most drives have slightly stricter ... but an 8MB buffer doing 4K random-ops could ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • Re: A problem about DIRECT IO on ext3
      ... fails if the offset or buffer is NOT filesystem blocksize ... So, its possible that your buffer is atleast 512byte aligned, ... > soft/hard sector sizes. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: x86, ARM, PARISC, PPC, MIPS and Sparc folks please run this
      ... write buffer and it isn't doing that. ... I'm saying that the bug can't be that, because such a bug would affect ... > performance isn't viable in such many embedded environments. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH] detailed physical memory info in fs/proc/task_mmu.c [2.6.0-test9]
      ... JOSE - Open Source dEvelopers at ufam.edu.br ... buffer += sprintf(buffer, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] PPC64: lockfix for rtas error log
      ... > forward it to the main 2.6 kernel maintainers. ... > This patch moves the location of a lock in order to protect ... a race existed whereby the buffer ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)