netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Hua <william.hua@canonical.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: netdev@vger.kernel.org, tgraf@suug.ch
Subject: Re: [PATCH] rhashtable: Always allocate at least one bucket lock
Date: Wed, 16 Dec 2015 02:33:30 -0500	[thread overview]
Message-ID: <567113CA.8030108@canonical.com> (raw)
In-Reply-To: <20151216055310.GA23634@gondor.apana.org.au>

On 12/16/2015 12:53 AM, Herbert Xu wrote:
> William Hua <william.hua@canonical.com> wrote:
>> No bucket locks are allocated when an rhashtable is initialized with
>> fewer than two elements. In this special case, we should allocate at
>> least one to prevent a segfault.
>>
>> Signed-off-by: William Hua <william.hua@canonical.com>
> 
> Huh? The minimum hash table size is 4.  How are you getting an
> rhashtable that's smaller than the required minimum?

I wasn't aware there was an enforced minimum size. I simply set the 
nelem_hint in the rhastable_params struct to 1, expecting it to grow as
needed. This caused a segfault afterwards when trying to insert an
element.

  reply	other threads:[~2015-12-16  7:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15 22:45 [PATCH] rhashtable: Always allocate at least one bucket lock William Hua
2015-12-16  5:53 ` Herbert Xu
2015-12-16  7:33   ` William Hua [this message]
2015-12-16 10:13     ` rhashtable: Enforce minimum size on initial hash table Herbert Xu
2015-12-16 15:45       ` David Miller

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=567113CA.8030108@canonical.com \
    --to=william.hua@canonical.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@suug.ch \
    /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;
as well as URLs for NNTP newsgroup(s).