mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
thp: remove assumptions on pgtable_t type
The thp page table pre-allocation code currently assumes that pgtable_t is of type "struct page *". This may not be true for all architectures, so this patch removes that assumption by replacing the functions prepare_pmd_huge_pte() and get_pmd_huge_pte() with two new functions that can be defined architecture-specific. It also removes two VM_BUG_ON checks for page_count() and page_mapcount() operating on a pgtable_t. Apart from the VM_BUG_ON removal, there will be no functional change introduced by this patch. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Hugh Dickins <hughd@google.com> Cc: Hillf Danton <dhillf@gmail.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
15626062f4
commit
e3ebcf6438
4 changed files with 55 additions and 43 deletions
|
@ -120,3 +120,42 @@ void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
|
|||
}
|
||||
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PGTABLE_DEPOSIT
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable)
|
||||
{
|
||||
assert_spin_locked(&mm->page_table_lock);
|
||||
|
||||
/* FIFO */
|
||||
if (!mm->pmd_huge_pte)
|
||||
INIT_LIST_HEAD(&pgtable->lru);
|
||||
else
|
||||
list_add(&pgtable->lru, &mm->pmd_huge_pte->lru);
|
||||
mm->pmd_huge_pte = pgtable;
|
||||
}
|
||||
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
|
||||
#endif
|
||||
|
||||
#ifndef __HAVE_ARCH_PGTABLE_WITHDRAW
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
/* no "address" argument so destroys page coloring of some arch */
|
||||
pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm)
|
||||
{
|
||||
pgtable_t pgtable;
|
||||
|
||||
assert_spin_locked(&mm->page_table_lock);
|
||||
|
||||
/* FIFO */
|
||||
pgtable = mm->pmd_huge_pte;
|
||||
if (list_empty(&pgtable->lru))
|
||||
mm->pmd_huge_pte = NULL;
|
||||
else {
|
||||
mm->pmd_huge_pte = list_entry(pgtable->lru.next,
|
||||
struct page, lru);
|
||||
list_del(&pgtable->lru);
|
||||
}
|
||||
return pgtable;
|
||||
}
|
||||
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue