aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/io_bitmap.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-11-11 23:03:25 +0100
committerThomas Gleixner <tglx@linutronix.de>2019-11-16 11:24:04 +0100
commit4804e382c117ce213cd5c43512cf4b1d71bb2650 (patch)
treea655461687013c631b6799b65d57943ea7840981 /arch/x86/include/asm/io_bitmap.h
parentx86/ioperm: Remove bitmap if all permissions dropped (diff)
downloadlinux-dev-4804e382c117ce213cd5c43512cf4b1d71bb2650.tar.xz
linux-dev-4804e382c117ce213cd5c43512cf4b1d71bb2650.zip
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>
Diffstat (limited to 'arch/x86/include/asm/io_bitmap.h')
-rw-r--r--arch/x86/include/asm/io_bitmap.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/include/asm/io_bitmap.h b/arch/x86/include/asm/io_bitmap.h
index 784a88edb25d..b664baadf736 100644
--- a/arch/x86/include/asm/io_bitmap.h
+++ b/arch/x86/include/asm/io_bitmap.h
@@ -2,15 +2,20 @@
#ifndef _ASM_X86_IOBITMAP_H
#define _ASM_X86_IOBITMAP_H
+#include <linux/refcount.h>
#include <asm/processor.h>
struct io_bitmap {
u64 sequence;
+ refcount_t refcnt;
/* The maximum number of bytes to copy so all zero bits are covered */
unsigned int max;
unsigned long bitmap[IO_BITMAP_LONGS];
};
+struct task_struct;
+
+void io_bitmap_share(struct task_struct *tsk);
void io_bitmap_exit(void);
void tss_update_io_bitmap(void);