LoongArch: Replace kmap_atomic() with kmap_local_page() in copy_user_highpage()

[ Upstream commit 477a0ebec1 ]

Replace kmap_atomic()/kunmap_atomic() calls with kmap_local_page()/
kunmap_local() in copy_user_highpage() which can be invoked from both
preemptible and atomic context [1].

[1] https://lore.kernel.org/all/20201029222652.302358281@linutronix.de/

Suggested-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Huacai Chen 2023-10-18 08:42:52 +08:00 committed by Greg Kroah-Hartman
parent afe80b58ee
commit ec80ad4585
1 changed files with 4 additions and 4 deletions

View File

@ -68,11 +68,11 @@ void copy_user_highpage(struct page *to, struct page *from,
{ {
void *vfrom, *vto; void *vfrom, *vto;
vto = kmap_atomic(to); vfrom = kmap_local_page(from);
vfrom = kmap_atomic(from); vto = kmap_local_page(to);
copy_page(vto, vfrom); copy_page(vto, vfrom);
kunmap_atomic(vfrom); kunmap_local(vfrom);
kunmap_atomic(vto); kunmap_local(vto);
/* Make sure this page is cleared on other CPU's too before using it */ /* Make sure this page is cleared on other CPU's too before using it */
smp_wmb(); smp_wmb();
} }