netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy King <acking@vmware.com>
To: Asias He <asias@redhat.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Dmitry Torokhov <dtor@vmware.com>,
	Reilly Grant <grantr@vmware.com>
Subject: Re: [PATCH 4/4] VSOCK: Fix VSOCK_HASH and VSOCK_CONN_HASH
Date: Thu, 20 Jun 2013 08:12:13 -0700 (PDT)	[thread overview]
Message-ID: <783609149.3265072.1371741133384.JavaMail.root@vmware.com> (raw)
In-Reply-To: <1371720033-19714-5-git-send-email-asias@redhat.com>

> If we mod with VSOCK_HASH_SIZE -1, we get 0, 1, .... 249.  Actually, we
> have vsock_bind_table[0 ... 250] and vsock_connected_table[0 .. 250].
> In this case the last entry will never be used.

If I remember correctly, we did this on purpose.  There's actually a
comment about it:

>   * VSOCK_HASH_SIZE + 1 so that vsock_bind_table[0] through
>   * vsock_bind_table[VSOCK_HASH_SIZE - 1] are for bound sockets and
>   * vsock_bind_table[VSOCK_HASH_SIZE] is for unbound sockets.  The hash

[250] is for unbound sockets.  If you hash on that, you'll mistakenly
get an unbound socket when looking for a bound one.

It is confusing, so perhaps a better way is just to move unbound into
its own table.

Thanks!
- Andy

  reply	other threads:[~2013-06-20 15:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20  9:20 [PATCH 0/4] VSOCK fix and cleanup Asias He
2013-06-20  9:20 ` [PATCH 1/4] VSOCK: Introduce vsock_auto_bind helper Asias He
2013-06-20 15:16   ` Andy King
2013-06-20  9:20 ` [PATCH 2/4] VSOCK: Return VMCI_ERROR_NO_MEM when fails to allocate skb Asias He
2013-06-20 15:15   ` Andy King
2013-06-20  9:20 ` [PATCH 3/4] VSOCK: Remove unnecessary label Asias He
2013-06-20 15:13   ` Andy King
2013-06-20  9:20 ` [PATCH 4/4] VSOCK: Fix VSOCK_HASH and VSOCK_CONN_HASH Asias He
2013-06-20 15:12   ` Andy King [this message]
2013-06-21  0:22     ` Asias He
2013-06-21 12:48       ` Andy King
2013-06-24  6:52 ` [PATCH 0/4] VSOCK fix and cleanup 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=783609149.3265072.1371741133384.JavaMail.root@vmware.com \
    --to=acking@vmware.com \
    --cc=asias@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dtor@vmware.com \
    --cc=grantr@vmware.com \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).