提交 259a290e 编写于 作者: A Akinobu Mita 提交者: Dave Airlie

gpu/drm/ttm: use copy_highpage

Use copy_highpage() to copy from one page to another.
Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 27796b46
...@@ -290,8 +290,6 @@ int ttm_tt_swapin(struct ttm_tt *ttm) ...@@ -290,8 +290,6 @@ int ttm_tt_swapin(struct ttm_tt *ttm)
struct file *swap_storage; struct file *swap_storage;
struct page *from_page; struct page *from_page;
struct page *to_page; struct page *to_page;
void *from_virtual;
void *to_virtual;
int i; int i;
int ret = -ENOMEM; int ret = -ENOMEM;
...@@ -311,11 +309,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm) ...@@ -311,11 +309,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm)
goto out_err; goto out_err;
preempt_disable(); preempt_disable();
from_virtual = kmap_atomic(from_page); copy_highpage(to_page, from_page);
to_virtual = kmap_atomic(to_page);
memcpy(to_virtual, from_virtual, PAGE_SIZE);
kunmap_atomic(to_virtual);
kunmap_atomic(from_virtual);
preempt_enable(); preempt_enable();
page_cache_release(from_page); page_cache_release(from_page);
} }
...@@ -336,8 +330,6 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage) ...@@ -336,8 +330,6 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
struct file *swap_storage; struct file *swap_storage;
struct page *from_page; struct page *from_page;
struct page *to_page; struct page *to_page;
void *from_virtual;
void *to_virtual;
int i; int i;
int ret = -ENOMEM; int ret = -ENOMEM;
...@@ -367,11 +359,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage) ...@@ -367,11 +359,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage)
goto out_err; goto out_err;
} }
preempt_disable(); preempt_disable();
from_virtual = kmap_atomic(from_page); copy_highpage(to_page, from_page);
to_virtual = kmap_atomic(to_page);
memcpy(to_virtual, from_virtual, PAGE_SIZE);
kunmap_atomic(to_virtual);
kunmap_atomic(from_virtual);
preempt_enable(); preempt_enable();
set_page_dirty(to_page); set_page_dirty(to_page);
mark_page_accessed(to_page); mark_page_accessed(to_page);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册