From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
ebiederm@xmission.com,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [1/2] SYSCTL: Make bin_table not const
Date: Sat, 19 Dec 2009 09:40:56 -0800 (PST) [thread overview]
Message-ID: <alpine.LFD.2.00.0912190929180.3712@localhost.localdomain> (raw)
In-Reply-To: <20091219145832.A0424B158A@basil.firstfloor.org>
On Sat, 19 Dec 2009, Andi Kleen wrote:
>
> Turn all the bin_tables from const to non-const. This is needed for the next
> patch. Unfortunately there were a lot of them, so the patch is rather
> large, but it is completely mechanic.
Ouch. I hate this.
I'd much rather have a constant sysctl bin_table.
If the _only_ thing you want to do is to do a "warn-on-once" logic, I
would seriously suggest you use a small hash-table instead of turning
bin_table non-const.
IOW, d something like this:
#define WARN_ONCE_HASH_BITS (10)
#define WARN_ONCE_HASH_SIZE (1<<WARN_ONCE_HASH_BITS)
static DECLARE_BITMAP(warn_once_bitmap, WARN_ONCE_HASH_SIZE);
/*
* NOTE! We don't use the SMP-safe bit tests. We simply
* don't care enough.
*/
static void warn_on_bintable(const int *name, int nlen)
{
unsigned int hash = full_name_hash(name, nlen);
hash = hash_32(hash, WARN_ONCE_HASH_BITS);
if (__test_and_set_bit(warn_once_bitmap, hash))
return;
deprecated_sysctl_warning(name, nlen);
}
which should do the right thing in all practical circumstances.
(The above is obviously totally untested, I wrote it in the mail reader,
but it's obvious enough what the intent is).
Linus
next prev parent reply other threads:[~2009-12-19 17:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-19 14:58 [PATCH] [0/2] SYSCTL: Warn once for all legacy syctls Andi Kleen
2009-12-19 14:58 ` [PATCH] [1/2] SYSCTL: Make bin_table not const Andi Kleen
2009-12-19 17:40 ` Linus Torvalds [this message]
2009-12-19 21:18 ` Andi Kleen
2009-12-20 20:06 ` Eric W. Biederman
2009-12-20 21:06 ` Andi Kleen
2009-12-21 1:23 ` [PATCH] SYSCTL: Print binary sysctl warnings (nearly) only once Andi Kleen
2009-12-19 14:58 ` [PATCH] [2/2] SYSCTL: Warn once for every binary sysctl Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.00.0912190929180.3712@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®