Skip to content

Commit

Permalink
LoongArch: Replace kmap_atomic() with kmap_local_page() in copy_user_…
Browse files Browse the repository at this point in the history
…highpage()

[ Upstream commit 477a0eb ]

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>
  • Loading branch information
chenhuacai authored and gregkh committed Nov 8, 2023
1 parent c86a4fb commit 6b43fea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/loongarch/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ void copy_user_highpage(struct page *to, struct page *from,
{
void *vfrom, *vto;

vto = kmap_atomic(to);
vfrom = kmap_atomic(from);
vfrom = kmap_local_page(from);
vto = kmap_local_page(to);
copy_page(vto, vfrom);
kunmap_atomic(vfrom);
kunmap_atomic(vto);
kunmap_local(vfrom);
kunmap_local(vto);
/* Make sure this page is cleared on other CPU's too before using it */
smp_wmb();
}
Expand Down

0 comments on commit 6b43fea

Please sign in to comment.