Re: Interesting VM feature?

From: Jamie Lokier
Date: Fri Aug 15 2003 - 08:03:34 EST


mouschi@xxxxxxxxx wrote:
> What this mempool wants to do is to be able to
> allocate a block of memory and tell the kernel which
> pages from it can be outright discarded, instead of
> swapped out when memory starts to get crowded.

You can call madvise(start, length, MADV_DONTNEED),
or you can mmap() fresh empty pages into the region.

I have no idea if either of these methods is efficient enough to be
useful. Also, I don't know whether mmap() would create multiple VMAs,
or if it is clever enough to merge adjacent vmas of anonymous private
mappings regardles of offset.

The ideal implementation would give the kernel the _option_ of
discarding pages until they are next touched, so that they are
discarded when there is memory pressure but retained if not, avoiding
the unnecessary zero-fill and cache flush.

Unfortunately, though much discussed a long time ago, the kernel
offers no service like this.

-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/