[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mmap and raw disk devices...
All,
My problem MAY be a version of the one in this ancient posting
(below). I'm using a variant of Linux 2.4.20 (RH7.3), and trying to
double buffer disk output using /dev/raw and a pair of mmap'd
regular files. One process fills one buffer (actually it does
nothing but execute a timer wait), while the other process
writes the contents of the other buffer to raw disk. Then the filler
process sends a message to the writer via pipe, and they swap
buffers. The filler is slower than the writer.
If I set the buffer size over about 10 MB (that's 20 MB total for
the double buffer, or 40 MB if you count each process's copy
as separate) I soon get an incomplete write, followed (when I
loop back to try writing the rest) by a perror of "Bad address". If
instead of doing nothing I tried "memset" in the filler process, this
used to be "Bus error". In an older Linux system (2.2.12-20, RH6.1)
I get a write of 0 bytes.
All of this goes away if I use a smaller buffer. If writing to a number
of disks in parallel, RAID0-style, it's the sum of the buffer sizes
that seems to matter. Unfortunately, I need about twice what I'm
getting! (By the way, user space mmap returns no errors in either
process.)
Thanks,
Larry Dickson
># From: ebiederm@xmission.com (Eric W. Biederman)
># Date: 19 Oct 2001 08:46:05 -0600
>
>Christopher Quinn <cq@htec.demon.co.uk> writes:
>
>> Hello list,
>>
>> I tried to mmap a disk partition raw device which failed.
>> Can anyone tell me the reason mmap does not support such a
>> device?
>> I would have thought a mmap/raw-device combination to be ideal as
>> a basis for a high performance database system.
>>
>> I know there is the option of managing memory<->disk movements
>> oneself, but my understanding is that handling page-faults via
>> signal trap handling is *very* expensive. Far better to leave
>> such matters in the hands of the OS.
>>
>> I suspect there is some fundamental reason for not mmap'ing raw
>> devices that is patently obvious to everyone but me!
>
>mmap goes through the page cache. It should work in 2.4.10+
>though someone might not have enabled it.
>
>Eric
>--
>To unsubscribe, send a message with 'unsubscribe linux-mm' in
>the body to majordomo@kvack.org. For more info on Linux MM,
>see: http://www.linux-mm.org/
--
Linux-mm-www: http://linux-mm.org/ website maintenance list
Archive: http://mail.nl.linux.org/linux-mm-www/
Development: linux-mm@kvack.org