x86/ioperm: Share I/O bitmap if identical
authorThomas Gleixner <tglx@linutronix.de>
Mon, 11 Nov 2019 22:03:25 +0000 (23:03 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 16 Nov 2019 10:24:04 +0000 (11:24 +0100)
commit4804e382c117ce213cd5c43512cf4b1d71bb2650
treea655461687013c631b6799b65d57943ea7840981
parentea5f1cd7ab494f65f50f338299eabb40ad6a1767
x86/ioperm: Share I/O bitmap if identical

The I/O bitmap is duplicated on fork. That's wasting memory and slows down
fork. There is no point to do so. As long as the bitmap is not modified it
can be shared between threads and processes.

Add a refcount and just share it on fork. If a task modifies the bitmap
then it has to do the duplication if and only if it is shared.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
arch/x86/include/asm/io_bitmap.h
arch/x86/kernel/ioport.c
arch/x86/kernel/process.c