netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Craig Gallek <kraigatgoog@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/4] soreuseport: define reuseport groups
Date: Tue, 22 Dec 2015 16:58:11 -0500	[thread overview]
Message-ID: <CAEfhGiyG8Y_amDZ2C8dQoQqjZJMHjTY76b=KBkTKcBtA=dhdGQ@mail.gmail.com> (raw)
In-Reply-To: <20151222.164024.1894169450945188344.davem@davemloft.net>

On Tue, Dec 22, 2015 at 4:40 PM, David Miller <davem@davemloft.net> wrote:
> From: Craig Gallek <kraigatgoog@gmail.com>
> Date: Tue, 22 Dec 2015 15:05:07 -0500
>
>> +     for (i = 0; i < reuse->num_socks; i++) {
>> +             if (reuse->socks[i] == sk) {
>> +                     reuse->socks[i] = reuse->socks[reuse->num_socks - 1];
>> +                     reuse->num_socks--;
>> +                     if (reuse->num_socks == 0)
>> +                             kfree_rcu(reuse, rcu);
>> +                     break;
>> +             }
>> +     }
>
> Don't you need to memmove() the entire rest of the array down one slot
> when you hit the matching 'sk' in there?  I can't see how it can work
> to only move one entry down.
It moves the last element in the list into the slot that was just
emptied.  You could argue that this may cause unexpected changes in
the index -> socket mapping observed by the user, but I'm not sure
making many socket indexes change (by sliding everything down one)
when one is removed is a desirable behavior either.  I don't have a
strong opinion either way though...

  reply	other threads:[~2015-12-22 21:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 20:05 [PATCH net-next 0/4] Faster SO_REUSEPORT Craig Gallek
2015-12-22 20:05 ` [PATCH net-next 1/4] soreuseport: define reuseport groups Craig Gallek
2015-12-22 21:40   ` David Miller
2015-12-22 21:58     ` Craig Gallek [this message]
2015-12-22 22:03       ` David Miller
2015-12-22 22:11   ` kbuild test robot
2015-12-22 22:39     ` Craig Gallek
2015-12-22 20:05 ` [PATCH net-next 2/4] soreuseport: fast reuseport UDP socket selection Craig Gallek
2015-12-22 20:05 ` [PATCH net-next 3/4] soreuseport: setsockopt SO_ATTACH_REUSEPORT_[CE]BPF Craig Gallek
2015-12-24 16:36   ` Alexei Starovoitov
2015-12-22 20:05 ` [PATCH net-next 4/4] soreuseport: BPF selection functional test Craig Gallek

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='CAEfhGiyG8Y_amDZ2C8dQoQqjZJMHjTY76b=KBkTKcBtA=dhdGQ@mail.gmail.com' \
    --to=kraigatgoog@gmail.com \
    --cc=davem@davemloft.net \
    --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).