On Fri, Oct 18, 2002 at 05:00:01PM +0300, Momchil Velikov wrote: > >>>>> "Jan" == Jan Hudec <bulb@ucw.cz> writes: > > Jan> On Fri, Oct 18, 2002 at 04:26:44PM +0300, Momchil Velikov wrote: > Jan> Yes, it should. But then message queue is most appropriate since it can > Jan> also pass the actual data along. That's what a file descriptor with > Jan> appropriately implemented poll is. > >> >> >> > >> >> >> It involves copying. Theoretically it is possible to have the read > >> >> >> system call avoid copying for whole overwriten pages (by exchanging > >> ^^^^^ > >> > >> >> >> page table entries (and flushing TLBs :-( )), but this may work well > >> >> >> on some systems, work not so well on others and not work AT ALL when > >> >> >> the source buffer is actually device memory. > >> >> > Jan> No, it won't work, because the read buffer would have to have same > Jan> alignment as the data in cache. > > It is not a problem as there's an easy and portable way to obtain > page-aligned user buffers. But applications don't use it... > >> >> > >> >> I do not understand this ? What do you mean ? What won't work ? > >> > Jan> You said, that read could possibly avoid copying by replacing PTEs. But > Jan> it counldn't unless the data is appropriately aligned. That is if you > Jan> read a whole page, starting at page-aligned offset and the buffer is > Jan> page-aligned, then it will work, but in most other cases it won't. > Jan> (Exact condition is: if buffer % PAGE_SIZE == offset % PAGE_SIZE, it > Jan> could be done, otherwise not.) > >> > >> Every buffer larger than or equal to two page sizes contains at least > >> one page aligned on page size boundary, i.e. at least one page frame. > >> That page can be remapped. That's why I said "whole overwriten pages". > > Jan> No, it does not. > > Uh, oh, yes, a little brainfart from my side. Anyway, while this > restriction is easy to be avoided, it is still another argument > against read based implementation. QED. It's better to have special interface than to change the semantics so that if (horribly complicated condition), it does something. Agreed. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz> -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/