[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090321162829.GF11183@elte.hu>
Date: Sat, 21 Mar 2009 17:28:29 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Eric Dumazet <dada1@...mosbay.com>
Cc: Ravikiran G Thirumalai <kiran@...lex86.org>,
linux-kernel@...r.kernel.org, shai@...lex86.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] futex: Dynamically size futexes hash table
* Eric Dumazet <dada1@...mosbay.com> wrote:
> @@ -2016,7 +2021,28 @@ static int __init futex_init(void)
> {
> u32 curval;
> int i;
> +#if !defined(CONFIG_BASE_SMALL)
> +#if defined(CONFIG_PROVE_LOCKING)
> + unsigned int nb_slots = 256;
> +#else
> + unsigned int nb_slots = roundup_pow_of_two(num_possible_cpus()) * 256;
> +#endif
> + size_t sz;
>
> +retry:
> + sz = nb_slots * sizeof(struct futex_hash_bucket);
> + if (sz > PAGE_SIZE)
> + futex_queues = vmalloc(sz);
> + else
> + futex_queues = kmalloc(sz, GFP_KERNEL);
> + if (!futex_queues) {
> + nb_slots >>= 1;
> + if (!nb_slots)
> + panic("Could not allocate futex hash table");
> + goto retry;
> + }
> + futex_hash_mask = nb_slots - 1;
> +#endif
no fundamental objections and the hash sizing problem is causing
real problems and need to be fixed, but this code sequence is too
ugly to live.
Is there really no big-hash-alloc framework in existence? I have
some vague memories of networking having met such problems in the
past - maybe they have some goodness there we could reuse
shamelessly in the futex code?
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists