Re: mmapped server
"Peter T. Breuer" <[email protected]> Sat, 25 Mar 2006 23:09:04 +0100 (MET)
| Newsgroups | gmane.linux.enbd.general |
|---|---|
| Message-ID | <[email protected]> |
"Also sprach Peter T. Breuer:" > --mmap,-M > > I must have a go ... Hmmm ... turning on some debugging seems to show that the server really does use mmap if asked: enbd-server 3427: mapping write request on from=3510272 len=28672 enbd-server 3427: mapping write request on from=3551232 len=32768 enbd-server 3427: mapping write request on from=3588096 len=4096 enbd-server 3427: mapping write request on from=3592192 len=4096 enbd-server 3427: mapping write request on from=3604480 len=4096 enbd-server 3427: mapping write request on from=3612672 len=4096 enbd-server 3427: mapping write request on from=3616768 len=12288 enbd-server 3427: mapping write request on from=3633152 len=12288 enbd-server 3427: mapping write request on from=3678208 len=4096 Apparently a mmapable request has to be aligned at 4K, and be a multiple of 4K in length, so one should use bs=4k, or/and turn on merge_requests. I wonder what happens if the resource is bigger than 2GB? I thought mmapping only worled up to 2GB. Maybe it remaps every time? Yesss .. the mmap is cleared after every request, and remapping occurs next time. I suppose I could cache the mmap. How would one do that? Sigh. Wouldn't the kernel know best about memory mappings? Why not just map ahead each time, and return the address if the request falls within the pre-mapped region? Otherwise I'd have to maintain something like a bitmap. I suppose I could lock the mmapped area, and check the lock, but that may be more expensive still. (the point of mmap is to save a copy operation, thus lowering server cpu overhead and increasing max server speed). Peter