shmobj: support large page
Change-Id: I104c1b8551b87f5cbfedb13262e77c00c38e9643
This commit is contained in:
committed by
Masamichi Takagi
parent
d2db639853
commit
47aec70f5f
@ -2654,7 +2654,8 @@ static int clear_range(struct page_table *pt, struct process_vm *vm,
|
||||
if (ptep && pte_is_contiguous(ptep)) {
|
||||
if (!page_is_contiguous_head(ptep, pgsize)) {
|
||||
// start pte is not contiguous head
|
||||
error = split_contiguous_pages(ptep, pgsize);
|
||||
error = split_contiguous_pages(ptep, pgsize,
|
||||
memobj ? memobj->flags : 0);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
@ -2666,7 +2667,8 @@ static int clear_range(struct page_table *pt, struct process_vm *vm,
|
||||
if (ptep && pte_is_contiguous(ptep)) {
|
||||
if (!page_is_contiguous_tail(ptep, pgsize)) {
|
||||
// end pte is not contiguous tail
|
||||
error = split_contiguous_pages(ptep, pgsize);
|
||||
error = split_contiguous_pages(ptep, pgsize,
|
||||
memobj ? memobj->flags : 0);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
@ -3287,7 +3289,8 @@ out:
|
||||
return error;
|
||||
}
|
||||
|
||||
int ihk_mc_pt_split(page_table_t pt, struct process_vm *vm, void *addr)
|
||||
int ihk_mc_pt_split(page_table_t pt, struct process_vm *vm,
|
||||
struct vm_range *range, void *addr)
|
||||
{
|
||||
int error;
|
||||
pte_t *ptep;
|
||||
@ -3309,7 +3312,9 @@ retry:
|
||||
if (ptep && !ptl_null(ptep, level) && (pgaddr != addr)) {
|
||||
page = NULL;
|
||||
if (ptl_is_contiguous(ptep, level)) {
|
||||
error = split_contiguous_pages(ptep, pgsize);
|
||||
error = split_contiguous_pages(ptep, pgsize,
|
||||
range->memobj ?
|
||||
range->memobj->flags : 0);
|
||||
if (error) {
|
||||
goto out;
|
||||
}
|
||||
@ -3320,8 +3325,8 @@ retry:
|
||||
phys = ptl_phys(ptep, level);
|
||||
page = phys_to_page(phys);
|
||||
}
|
||||
if (page && (page_is_in_memobj(page)
|
||||
|| page_is_multi_mapped(page))) {
|
||||
if (!is_splitable(page, range->memobj ?
|
||||
range->memobj->flags : 0)) {
|
||||
error = -EINVAL;
|
||||
kprintf("ihk_mc_pt_split:NYI:page break down\n");
|
||||
goto out;
|
||||
@ -3494,7 +3499,9 @@ int move_pte_range(page_table_t pt, struct process_vm *vm,
|
||||
if (ptep && pte_is_contiguous(ptep)) {
|
||||
if (!page_is_contiguous_head(ptep, pgsize)) {
|
||||
// start pte is not contiguous head
|
||||
error = split_contiguous_pages(ptep, pgsize);
|
||||
error = split_contiguous_pages(ptep, pgsize,
|
||||
range->memobj ?
|
||||
range->memobj->flags : 0);
|
||||
if (error) {
|
||||
goto out;
|
||||
}
|
||||
@ -3505,7 +3512,9 @@ int move_pte_range(page_table_t pt, struct process_vm *vm,
|
||||
if (ptep && pte_is_contiguous(ptep)) {
|
||||
if (!page_is_contiguous_tail(ptep, pgsize)) {
|
||||
// end pte is not contiguous tail
|
||||
error = split_contiguous_pages(ptep, pgsize);
|
||||
error = split_contiguous_pages(ptep, pgsize,
|
||||
range->memobj ?
|
||||
range->memobj->flags : 0);
|
||||
if (error) {
|
||||
goto out;
|
||||
}
|
||||
@ -4110,3 +4119,30 @@ void arch_adjust_allocate_page_size(struct page_table *pt,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int split_contiguous_pages(pte_t *ptep, size_t pgsize,
|
||||
uint32_t memobj_flags)
|
||||
{
|
||||
int ret;
|
||||
pte_t *head = get_contiguous_head(ptep, pgsize);
|
||||
pte_t *tail = get_contiguous_tail(ptep, pgsize);
|
||||
pte_t *ptr;
|
||||
|
||||
uintptr_t phys;
|
||||
struct page *page;
|
||||
|
||||
phys = pte_get_phys(head);
|
||||
page = phys_to_page(phys);
|
||||
if (!is_splitable(page, memobj_flags)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (ptr = head; ptr <= tail; ptr++) {
|
||||
*ptr &= ~PTE_CONT;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user