madvise() (was: Re: OFFTOPIC: Regarding NT vs Linux)

Alex Belits (abelits@phobos.illtel.denver.co.us)
Tue, 23 Sep 1997 11:11:16 -0700 (PDT)


On Tue, 23 Sep 1997, Michael Weller wrote:

> > > On the other hand, [touching each page in the mmap'd file space]
> > > will first pagefault as fast as possible, allowing the drive to get
> > > all pages in one go, and then write the data from memory.
> >
> > ... unless the file is too big to fit into memory, in which case it
> > gets paged in, swapped out, and paged back in again -- highly
> > non-optimal.
>
> Well, but what else would a copy_file do in this situation? As the file

madvise() exists for that purpose in other systems. It's a nice and useful
way to tell VM, what is expected to happen with a memory region, and it's
useful for other purposes. IMHO it will significantly help in such cases,
especially considering the results of
file-reading-sending/file-mmaping-sending tests, where reading was faster
because of read-ahead even with overhead of buffer copying and multiple
syscalls.

--
Alex