Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: Avoid false-sharing flip buffer ptrs

Separate the head and tail ptrs to avoid cache-line contention
(so called 'false-sharing') between concurrent threads.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Peter Hurley and committed by
Greg Kroah-Hartman
8c1fb49b d7a68be4

+2 -2
+2 -2
include/linux/tty.h
··· 65 65 66 66 67 67 struct tty_bufhead { 68 + struct tty_buffer *head; /* Queue head */ 68 69 struct work_struct work; 69 70 struct mutex flush_mutex; 70 71 struct tty_buffer sentinel; 71 - struct tty_buffer *head; /* Queue head */ 72 - struct tty_buffer *tail; /* Active buffer */ 73 72 struct llist_head free; /* Free queue head */ 74 73 atomic_t memory_used; /* In-use buffers excluding free list */ 74 + struct tty_buffer *tail; /* Active buffer */ 75 75 }; 76 76 /* 77 77 * When a break, frame error, or parity error happens, these codes are