This is based on the shmem version, but it has diverged quite a bit. We
have no swap to worry about, nor the new file sealing. Add
synchronication via the fault mutex table to coordinate page faults,
fallocate allocation and fallocate hole punch.
What this allows us to do is move physical memory in and out of a
hugetlbfs file without having it mapped. This also gives us the ability
to support MADV_REMOVE since it is currently implemented using
fallocate(). MADV_REMOVE lets madvise() remove pages from the middle of
a hugetlbfs file, which wasn't possible before.
hugetlbfs fallocate only operates on whole huge pages.
Based on code by Dave Hansen.
Signed-off-by: Mike Kravetz <firstname.lastname@example.org>
Reviewed-by: Naoya Horiguchi <email@example.com>
Acked-by: Hillf Danton <firstname.lastname@example.org>
Cc: Dave Hansen <email@example.com>
Cc: David Rientjes <firstname.lastname@example.org>
Cc: Hugh Dickins <email@example.com>
Cc: Davidlohr Bueso <firstname.lastname@example.org>
Cc: Aneesh Kumar <email@example.com>
Cc: Christoph Hellwig <firstname.lastname@example.org>
Cc: Michal Hocko <email@example.com>
Signed-off-by: Andrew Morton <firstname.lastname@example.org>
Signed-off-by: Linus Torvalds <email@example.com>