summaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_tty.c
diff options
context:
space:
mode:
authorPeter Hurley2013-06-15 16:04:29 +0200
committerGreg Kroah-Hartman2013-07-24 02:02:22 +0200
commit9dfd16ddea9bdbc8343340e543732db0a467ae32 (patch)
treef5ab13fd7bbc7ff99ccc44ecf127fede65452dc2 /drivers/tty/n_tty.c
parentn_tty: Eliminate counter in __process_echoes (diff)
downloadkernel-qcow2-linux-9dfd16ddea9bdbc8343340e543732db0a467ae32.tar.gz
kernel-qcow2-linux-9dfd16ddea9bdbc8343340e543732db0a467ae32.tar.xz
kernel-qcow2-linux-9dfd16ddea9bdbc8343340e543732db0a467ae32.zip
n_tty: Avoid false-sharing echo buffer indices
Separate the head & commit indices from the tail index 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>
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r--drivers/tty/n_tty.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 7f15b269cf3e..d4d71350a71d 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -90,6 +90,8 @@ struct n_tty_data {
/* producer-published */
size_t read_head;
size_t canon_head;
+ size_t echo_head;
+ size_t echo_commit;
DECLARE_BITMAP(process_char_map, 256);
/* private to n_tty_receive_overrun (single-threaded) */
@@ -105,20 +107,17 @@ struct n_tty_data {
/* shared by producer and consumer */
char *read_buf;
DECLARE_BITMAP(read_flags, N_TTY_BUF_SIZE);
+ unsigned char *echo_buf;
int minimum_to_wake;
/* consumer-published */
size_t read_tail;
- unsigned char *echo_buf;
- size_t echo_head;
- size_t echo_tail;
- size_t echo_commit;
-
/* protected by output lock */
unsigned int column;
unsigned int canon_column;
+ size_t echo_tail;
struct mutex atomic_read_lock;
struct mutex output_lock;