mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
mm: postpone page table allocation until we have page to map
The idea (and most of code) is borrowed again: from Hugh's patchset on huge tmpfs[1]. Instead of allocation pte page table upfront, we postpone this until we have page to map in hands. This approach opens possibility to map the page as huge if filesystem supports this. Comparing to Hugh's patch I've pushed page table allocation a bit further: into do_set_pte(). This way we can postpone allocation even in faultaround case without moving do_fault_around() after __do_fault(). do_set_pte() got renamed to alloc_set_pte() as it can allocate page table if required. [1] http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/1466021202-61880-10-git-send-email-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
bae473a423
commit
7267ec008b
3 changed files with 197 additions and 127 deletions
16
mm/filemap.c
16
mm/filemap.c
|
|
@ -2144,11 +2144,6 @@ void filemap_map_pages(struct fault_env *fe,
|
|||
start_pgoff) {
|
||||
if (iter.index > end_pgoff)
|
||||
break;
|
||||
fe->pte += iter.index - last_pgoff;
|
||||
fe->address += (iter.index - last_pgoff) << PAGE_SHIFT;
|
||||
last_pgoff = iter.index;
|
||||
if (!pte_none(*fe->pte))
|
||||
goto next;
|
||||
repeat:
|
||||
page = radix_tree_deref_slot(slot);
|
||||
if (unlikely(!page))
|
||||
|
|
@ -2186,7 +2181,13 @@ repeat:
|
|||
|
||||
if (file->f_ra.mmap_miss > 0)
|
||||
file->f_ra.mmap_miss--;
|
||||
do_set_pte(fe, page);
|
||||
|
||||
fe->address += (iter.index - last_pgoff) << PAGE_SHIFT;
|
||||
if (fe->pte)
|
||||
fe->pte += iter.index - last_pgoff;
|
||||
last_pgoff = iter.index;
|
||||
if (alloc_set_pte(fe, NULL, page))
|
||||
goto unlock;
|
||||
unlock_page(page);
|
||||
goto next;
|
||||
unlock:
|
||||
|
|
@ -2194,6 +2195,9 @@ unlock:
|
|||
skip:
|
||||
put_page(page);
|
||||
next:
|
||||
/* Huge page is mapped? No need to proceed. */
|
||||
if (pmd_trans_huge(*fe->pmd))
|
||||
break;
|
||||
if (iter.index == end_pgoff)
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue