[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread implementations...



ebiederm+eric@npwt.net (Eric W. Biederman) writes:

> > 	    MADV_DONTNEED
> > 		      Do not need these	pages
> 
> > 		      The system will free any resident	pages that are allo-
> > 		      cated to the region.  All	modifications will be lost
> > 		      and any swapped out pages	will be	discarded.  Subse-
> > 		      quent access to the region will result in	a zero-fill-
> > 		      on-demand	fault as though	it is being accessed for the
> > 		      first time.  Reserved swap space is not affected by
> > 		      this call.
> 
> This one is broken, for 3 reasons.
> 1) madvise should only give advise.
> 2) This can be done with mmap(start, len, PROT..., MAP_ANON, -1, 0)
> 3) There is a more reasonable interpretation from IRIX:
> 
>      MADV_DONTNEED    informs the system that the address range	from addr to
> 		      addr + len will likely not be referenced in the near
> 		      future.  The memory to which the indicated addresses are
> 		      mapped will be the first to be reclaimed when memory is
> 		      needed by	the system.

I do not agree:

1) why should madvise only advise. O.K. it is a naming thing, but I
   think you can find more terms which went far from the original
   meaning.
2) Would not work on shared pages.
3) Why is IRIX more reasonable than any other implementation?

The functionality described in the OSF manpage greatly help
transactional programs, which use loads of memory for single
transactions. I do not know if it should be done with madvise, but
there is at least one OS which thinks it is the right place and I
would look for this functionality exactly there.

Cheers
      Christoph
--
#include <stddisclaimer.h>