Berkeley CSUA MOTD:2000:July:23 Sunday <Saturday>
Berkeley CSUA MOTD
2000/7/23 [Recreation/Shopping] UID:18760 Activity:low
7/22    Does anyone have a recommendation for a shoe repair shop in or
        around Berkeley?  I need a pair of shoes repaired. --chris
        \_ I use this tiny shop on Lakeshore Ave in Oakland.
           Not especially good, but I trust them to fix simple things.
2000/7/23 [Health] UID:18761 Activity:nil
7/21    \_
2000/7/23-26 [Computer/SW/OS/Solaris] UID:18762 Activity:high
7/23    If I have data in my process address space on Solaris,
        and I want to get that memory onto disk without doing
        a copy, is there a way to do this? --jwm
        \_ What does "without doing a copy" mean?  As always, why don't
           you tell us what you're trying to do instead of asking for a
           specific technical answer to do it your way.
           \_ "Without a copy" means without making a copy in memory.
              (i.e. no copy from the userland buffer to a kernel buffer)
              I have a chunk of data in memory, I want to get it onto
            a particular disk via a raw device.
              a particular disk via a raw device.  Why I want to do this
              is not of any great importance to the question.
           \_ i think what he's asking is pretty straightforward, what is
              your problem? jwm, do you know if mmapped files in solaris
              go through the block buffers?
              \_ my problem is people on the motd tend to ask vague technical
                 questions which don't always mean what they seem to.  what's
                 your problem with my asking what he's trying to do so he can
                 get helped better?
              \_ Yeah, I thought of mmap(), but here is the problem with
                 that.  I map the file, then when I write to a page,
                 I get a fault that reads in the the data off disk.
                 This is data I am just about to overwrite, plus this
                 also has a copy from my buffer to the mmap'ed region.
                 If I could take my buffer and map it onto the file
                 that would work, but I don't think this is supported.
                 The 2 methods I can think of that may work are write()
                 and aio_write() because they both "own" the buffer during
                 the time the write is happening.  If I had solaris source
                 this would be easy to check, but I don't.  The idea is
                 that Solaris would simply point the DMA engine at my
                 buffer and never look at my data. --jwm
                 \_ my point was that you could mmap your buffer instead of
                    allocating it with malloc() (or on the stack).
                    i don't see why write() helps, as it does a write to
                    the block buffers, not to disk. i don't know anything
                    about aio_write. is there no way in solaris to lock
                    a block buffer and write to it directly? that's how it
                    fucking works in the kernel.
                    \_ It's a raw device I'm writing to, so no block buffers.
                       I can't mmap instead, because I'm not generating the
                       data. I guess the best way to describe what I want is
                       to say I want to avoid a copyin() and have DMA go
                       directly from my memory to the device. --jwm
                       \_ why do you suspect write() does a copyin() when
                          writing to block device? when i write a driver,
                          i mlock() then setup dma from the user's address
                          \_ I didn't know, but I suspected that write may not
                             have the copy (See above). However as a
                             block devices are probably doing the copyin() in
                             all cases because they interact with the buffer
                             cache, it is raw/character devices that don't.
Berkeley CSUA MOTD:2000:July:23 Sunday <Saturday>