OSDN Git Service

sched: highmem: Store local kmaps in task struct
authorThomas Gleixner <tglx@linutronix.de>
Wed, 18 Nov 2020 19:48:43 +0000 (20:48 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 24 Nov 2020 13:42:09 +0000 (14:42 +0100)
commit5fbda3ecd14a5343644979c98d6eb65b7e7de9d8
tree6bd9a839faabd90f349b3204c14b9728f99cba2e
parent14df32670291588036a498051a54cd8462d7f611
sched: highmem: Store local kmaps in task struct

Instead of storing the map per CPU provide and use per task storage. That
prepares for local kmaps which are preemptible.

The context switch code is preparatory and not yet in use because
kmap_atomic() runs with preemption disabled. Will be made usable in the
next step.

The context switch logic is safe even when an interrupt happens after
clearing or before restoring the kmaps. The kmap index in task struct is
not modified so any nesting kmap in an interrupt will use unused indices
and on return the counter is the same as before.

Also add an assert into the return to user space code. Going back to user
space with an active kmap local is a nono.

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