Hi, I promised to Mike to have a look into this a few weeks ago. This is my first attempt. I carried out some tests with a module that tries to allocate with alloc_contig_range() from a range where we have free and in-use hugetlb pages. So far I did not spot any problem and it worked. Please, note that it is not fully completed, as some things remain to be sorted out (see list below), but I wanted to publish it to see whether the way I am going makes sense to people, or I am doing something worrisome. E.g: - What happens when we allocated a new hugetlb page, but we cannot dissolve the old one? (should not really happen (tm)) - When allocating the new hugetlb page I try to do it in the same node the old one is. Should we be more flexible and allow to fallback to other nodes? Userspace can request hugetlb on specific nodes [1], but it can also request them through generic interfaces [2]. - Problems I did not foresee yet [1] /sys/devices/system/node/nodeX/hugepages/* [2] /proc/sys/vm/nr_hugepages or /sys/kernel/mm/hugepages/* Oscar Salvador (2): mm,page_alloc: Make alloc_contig_range handle in-use hugetlb pages mm,page_alloc: Make alloc_contig_range handle free hugetlb pages include/linux/hugetlb.h | 6 ++++++ mm/compaction.c | 28 ++++++++++++++++++++++++++++ mm/hugetlb.c | 35 +++++++++++++++++++++++++++++++++++ mm/vmscan.c | 5 +++-- 4 files changed, 72 insertions(+), 2 deletions(-) -- 2.16.3