Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1395357
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [patch V2 4/7] futex: Add sysctl knobs for process private hash |
| Date | 2016-05-05 22:50 +0200 |
| Message-ID | <rvynF-79b-11@gated-at.bofh.it> (permalink) |
| References | <rvynE-79b-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Sebastian Siewior <bigeasy@linutronix.de>
To adjust the default hash size and the maximum hash size for process private
futexes we add the following sysctls:
futex_private_default_hash_bits:
Adjusts the default hash size (in bits) which is used for automatic hash
allocations on the first futex operation
futex_private_max_hash_bits:
Adjusts the maximum hash size (in bits). This limits the hash size which
can be preallocated by applications with the FUTEX_PREALLOC_HASH op.
Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
Documentation/sysctl/kernel.txt | 17 +++++++++++++++++
include/linux/futex.h | 1 +
kernel/futex.c | 5 +++--
kernel/sysctl.c | 21 +++++++++++++++++++++
4 files changed, 42 insertions(+), 2 deletions(-)
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -29,6 +29,8 @@ Currently, these files might (depending
- core_pipe_limit
- core_uses_pid
- ctrl-alt-del
+- futex_private_default_hash_bits
+- futex_private_max_hash_bits
- dmesg_restrict
- domainname
- hostname
@@ -265,6 +267,21 @@ to decide what to do with it.
==============================================================
+futex_private_default_hash_bits:
+
+Adjusts the default hash size (in bits) which is used for
+automatic hash allocations on the first futex operation
+
+==============================================================
+
+futex_private_max_hash_bits:
+
+Adjusts the maximum hash size (in bits). This limits the hash
+size which can be preallocated by applications with the
+FUTEX_PREALLOC_HASH op.
+
+==============================================================
+
dmesg_restrict:
This toggle indicates whether unprivileged users are prevented
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -75,6 +75,7 @@ static inline void exit_pi_state_list(st
extern unsigned int futex_default_hash_bits;
extern unsigned int futex_max_hash_bits;
+extern unsigned int futex_sysmax_hash_bits;
extern void futex_mm_hash_exit(struct mm_struct *mm);
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -297,8 +297,9 @@ struct futex_hash_bucket {
#define FUTEX_DEF_HASH_BITS order_base_2(8UL)
#define FUTEX_MAX_HASH_BITS order_base_2(256UL)
-unsigned int futex_default_hash_bits = FUTEX_DEF_HASH_BITS;
-unsigned int futex_max_hash_bits = FUTEX_MAX_HASH_BITS;
+unsigned int futex_default_hash_bits = FUTEX_DEF_HASH_BITS;
+unsigned int futex_max_hash_bits = FUTEX_MAX_HASH_BITS;
+unsigned int __read_mostly futex_sysmax_hash_bits = FUTEX_MAX_HASH_BITS;
#else
static const unsigned int futex_default_hash_bits = 0;
#endif
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -65,6 +65,7 @@
#include <linux/sched/sysctl.h>
#include <linux/kexec.h>
#include <linux/bpf.h>
+#include <linux/futex.h>
#include <asm/uaccess.h>
#include <asm/processor.h>
@@ -593,6 +594,26 @@ static struct ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec,
},
+#ifdef CONFIG_FUTEX_PRIVATE_HASH
+ {
+ .procname = "futex_private_default_hash_bits",
+ .data = &futex_default_hash_bits,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = &two,
+ .extra2 = &futex_max_hash_bits,
+ },
+ {
+ .procname = "futex_private_max_hash_bits",
+ .data = &futex_max_hash_bits,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = &futex_default_hash_bits,
+ .extra2 = &futex_sysmax_hash_bits,
+ },
+#endif
#ifdef CONFIG_FUNCTION_TRACER
{
.procname = "ftrace_enabled",
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[patch V2 0/7] futex: Add support for process private hashing Thomas Gleixner <tglx@linutronix.de> - 2016-05-05 22:50 +0200
[patch V2 4/7] futex: Add sysctl knobs for process private hash Thomas Gleixner <tglx@linutronix.de> - 2016-05-05 22:50 +0200
Re: [patch V2 4/7] futex: Add sysctl knobs for process private hash Darren Hart <dvhart@infradead.org> - 2016-05-06 20:30 +0200
[patch V2 5/7] perf/bench/futex-hash: Support NUMA Thomas Gleixner <tglx@linutronix.de> - 2016-05-05 22:50 +0200
[patch V2 2/7] futex: Hash private futexes per process Thomas Gleixner <tglx@linutronix.de> - 2016-05-05 22:50 +0200
Re: [patch V2 2/7] futex: Hash private futexes per process Darren Hart <dvhart@infradead.org> - 2016-05-06 20:10 +0200
Re: [patch V2 2/7] futex: Hash private futexes per process Darren Hart <dvhart@infradead.org> - 2016-05-07 00:00 +0200
Re: [patch V2 2/7] futex: Hash private futexes per process Thomas Gleixner <tglx@linutronix.de> - 2016-05-07 10:50 +0200
Re: [patch V2 2/7] futex: Hash private futexes per process Darren Hart <dvhart@infradead.org> - 2016-05-11 23:10 +0200
Re: [patch V2 2/7] futex: Hash private futexes per process Thomas Gleixner <tglx@linutronix.de> - 2016-05-07 10:50 +0200
Re: [patch V2 2/7] futex: Hash private futexes per process Darren Hart <dvhart@infradead.org> - 2016-05-11 23:10 +0200
[patch V2 6/7] perf/bench/futex-hash: Support preallocate hash table Thomas Gleixner <tglx@linutronix.de> - 2016-05-05 22:50 +0200
[patch V2 1/7] futex: Add some more function commentry Thomas Gleixner <tglx@linutronix.de> - 2016-05-05 22:50 +0200
Re: [patch V2 1/7] futex: Add some more function commentry Darren Hart <dvhart@infradead.org> - 2016-05-06 19:40 +0200
[patch V2 7/7] futex.2: Document hash preallocation opcode Thomas Gleixner <tglx@linutronix.de> - 2016-05-05 22:50 +0200
csiph-web