invalidate_one_page: Support shmobj and contiguous PTE

Change-Id: I15b74ee4afd8e2dc52c933925aae4a1e0d8bcc72
This commit is contained in:
Masamichi Takagi
2018-12-14 17:14:29 +09:00
committed by Dominique Martinet
parent b174fb8099
commit bdf5175d4c
2 changed files with 30 additions and 44 deletions

View File

@@ -37,7 +37,6 @@ static memobj_lookup_page_func_t shmobj_lookup_page;
static struct memobj_ops shmobj_ops = {
.free = &shmobj_free,
.get_page = &shmobj_get_page,
.invalidate_page = &shmobj_invalidate_page,
.lookup_page = &shmobj_lookup_page,
};
@@ -440,44 +439,6 @@ out:
return error;
}
static int shmobj_invalidate_page(struct memobj *memobj, uintptr_t phys,
size_t pgsize)
{
struct shmobj *obj = to_shmobj(memobj);
int error;
struct page *page;
dkprintf("shmobj_invalidate_page(%p,%#lx,%#lx)\n", memobj, phys, pgsize);
page_list_lock(obj);
if (!(page = phys_to_page(phys))
|| !(page = page_list_lookup(obj, page->offset))) {
page_list_unlock(obj);
error = 0;
goto out;
}
page_list_unlock(obj);
if (ihk_atomic_read(&page->count) == 1) {
if (page_unmap(page)) {
ihk_mc_free_pages_user(phys_to_virt(phys),
pgsize/PAGE_SIZE);
/* Track change in page->count for shmobj.
* It is decremented in here or shmobj_destroy() or
* clear_range().
*/
dkprintf("%lx-,%s: calling memory_stat_rss_sub(),phys=%lx,size=%ld,pgsize=%ld\n",
phys, __func__, phys, pgsize, pgsize);
memory_stat_rss_sub(pgsize, pgsize);
}
}
error = 0;
out:
dkprintf("shmobj_invalidate_page(%p,%#lx,%#lx):%d\n", memobj, phys, pgsize, error);
return error;
}
static int shmobj_lookup_page(struct memobj *memobj, off_t off, int p2align,
uintptr_t *physp, unsigned long *pflag)
{