Re: vma_merge issue

From: Hugh Dickins
Date: Wed Aug 12 2009 - 16:53:50 EST


On Wed, 12 Aug 2009, Hugh Dickins wrote:
>
> Don't use anonymous memory, have a 1GB sparse file to back this,
> and mmap it MAP_SHARED, then you won't get charged for RAM+swap.

A "refinement" to that suggestion is to put the file on tmpfs:
you will then get charged for RAM+swap as you use it, but you can
use madvise MADV_REMOVE to unmap pages, punching holes in the file,
freeing up those charges. A little baroque, but I think it does
amount to a way of doing exactly what you wanted in the first place.

(Note: we do insist on PROT_WRITE access at the time of MADV_REMOVE:
I've even a feeling it was me who insisted on that.)

Hugh
--
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/