mm/highmem: Provide kmap_local*
authorThomas Gleixner <tglx@linutronix.de>
Wed, 18 Nov 2020 19:48:44 +0000 (20:48 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 24 Nov 2020 13:42:09 +0000 (14:42 +0100)
commitf3ba3c710ac5a30cd058615a9eb62d2ad95bb782
tree1678112f3c1f9793ac5551679cfe2a275a270543
parent5fbda3ecd14a5343644979c98d6eb65b7e7de9d8
mm/highmem: Provide kmap_local*

Now that the kmap atomic index is stored in task struct provide a
preemptible variant. On context switch the maps of an outgoing task are
removed and the map of the incoming task are restored. That's obviously
slow, but highmem is slow anyway.

The kmap_local.*() functions can be invoked from both preemptible and
atomic context. kmap local sections disable migration to keep the resulting
virtual mapping address correct, but disable neither pagefaults nor
preemption.

A wholesale conversion of kmap_atomic to be fully preemptible is not
possible because some of the usage sites might rely on the preemption
disable for serialization or on the implicit pagefault disable. Needs to be
done on a case by case basis.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20201118204007.468533059@linutronix.de
include/linux/highmem-internal.h
include/linux/highmem.h
mm/highmem.c