diff options
author | Andi Kleen <ak@linux.intel.com> | 2009-12-23 21:00:20 +0100 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2009-12-23 21:00:20 +0100 |
commit | 4440095c8268c1a5e11577097d2be429cec036ca (patch) | |
tree | 7e1ca48bcd8fd0b947a7cc0edf31c0af9bbc4ec3 /kernel/ptrace.c | |
parent | f42ecb2808db5386f983d593a7c08d3ea3b94a27 (diff) |
SYSCTL: Print binary sysctl warnings (nearly) only once
When printing legacy sysctls print the warning message
for each of them only once. This way there is a guarantee
the syslog won't be flooded for any sane program.
The original attempt at this made the tables non const and stored
the flag inline.
Linus suggested using a separate hash table for this, this is based on a
code snippet from him.
The hash implies this is not exact and can sometimes not print a
new sysctl due to a hash collision, but in practice this should not
be a problem
I used a FNV32 hash over the binary string with a 32byte bitmap. This
gives relatively little collisions when all the predefined binary sysctls
are hashed:
size 256
bucket
length number
0: [25]
1: [67]
2: [88]
3: [47]
4: [22]
5: [6]
6: [1]
The worst case is a single collision of 6 hash values.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'kernel/ptrace.c')
0 files changed, 0 insertions, 0 deletions