lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1578885793-24095-1-git-send-email-qiwuchen55@gmail.com>
Date:   Mon, 13 Jan 2020 11:23:13 +0800
From:   qiwuchen55@...il.com
To:     christian.brauner@...ntu.com, peterz@...radead.org,
        mingo@...nel.org, tglx@...utronix.de, oleg@...hat.com,
        elena.reshetova@...el.com, jgg@...pe.ca, christian@...lner.me,
        aarcange@...hat.com, viro@...iv.linux.org.uk, cyphar@...har.com,
        ldv@...linux.org
Cc:     linux-kernel@...r.kernel.org, chenqiwu <chenqiwu@...omi.com>
Subject: [PATCH] kernel/fork: put some fork variables into read-mostly section

From: chenqiwu <chenqiwu@...omi.com>

Since total_forks/nr_threads/max_threads global variables are
frequently used for process fork, putting these variables into
read_mostly section can avoid unnecessary cache line bouncing.

Signed-off-by: chenqiwu <chenqiwu@...omi.com>
---
 kernel/fork.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 0808095..163e152 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -120,10 +120,10 @@
 /*
  * Protected counters by write_lock_irq(&tasklist_lock)
  */
-unsigned long total_forks;	/* Handle normal Linux uptimes. */
-int nr_threads;			/* The idle threads do not count.. */
+unsigned long total_forks __read_mostly; /* Handle normal Linux uptimes. */
+int nr_threads __read_mostly;  /* The idle threads do not count.. */
 
-static int max_threads;		/* tunable limit on nr_threads */
+static int max_threads __read_mostly; /* tunable limit on nr_threads */
 
 #define NAMED_ARRAY_INDEX(x)	[x] = __stringify(x)
 
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ