diff options
author | Andrea Arcangeli <aarcange@redhat.com> | 2011-01-13 18:46:45 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 20:32:41 -0500 |
commit | e7a00c45f29c0155007aa150bf231a70fa470365 (patch) | |
tree | 3225a79905dede614ed44e98776cdc6285bbd28a /kernel | |
parent | 4e6af67e970a2ac287739a4c526c857b5bda27ec (diff) |
thp: add pmd_huge_pte to mm_struct
This increase the size of the mm struct a bit but it is needed to
preallocate one pte for each hugepage so that split_huge_page will not
require a fail path. Guarantee of success is a fundamental property of
split_huge_page to avoid decrasing swapping reliability and to avoid
adding -ENOMEM fail paths that would otherwise force the hugepage-unaware
VM code to learn rolling back in the middle of its pte mangling operations
(if something we need it to learn handling pmd_trans_huge natively rather
being capable of rollback). When split_huge_page runs a pte is needed to
succeed the split, to map the newly splitted regular pages with a regular
pte. This way all existing VM code remains backwards compatible by just
adding a split_huge_page* one liner. The memory waste of those
preallocated ptes is negligible and so it is worth it.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/fork.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 1499607e4da2..f78f50ba6cb2 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -529,6 +529,9 @@ void __mmdrop(struct mm_struct *mm) | |||
529 | mm_free_pgd(mm); | 529 | mm_free_pgd(mm); |
530 | destroy_context(mm); | 530 | destroy_context(mm); |
531 | mmu_notifier_mm_destroy(mm); | 531 | mmu_notifier_mm_destroy(mm); |
532 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
533 | VM_BUG_ON(mm->pmd_huge_pte); | ||
534 | #endif | ||
532 | free_mm(mm); | 535 | free_mm(mm); |
533 | } | 536 | } |
534 | EXPORT_SYMBOL_GPL(__mmdrop); | 537 | EXPORT_SYMBOL_GPL(__mmdrop); |
@@ -669,6 +672,10 @@ struct mm_struct *dup_mm(struct task_struct *tsk) | |||
669 | mm->token_priority = 0; | 672 | mm->token_priority = 0; |
670 | mm->last_interval = 0; | 673 | mm->last_interval = 0; |
671 | 674 | ||
675 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
676 | mm->pmd_huge_pte = NULL; | ||
677 | #endif | ||
678 | |||
672 | if (!mm_init(mm, tsk)) | 679 | if (!mm_init(mm, tsk)) |
673 | goto fail_nomem; | 680 | goto fail_nomem; |
674 | 681 | ||