netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: David Miller <davem@davemloft.net>
Cc: <hannes@stressinduktion.org>, <kraigatgoog@gmail.com>,
	<eric.dumazet@gmail.com>, <tom@herbertland.com>,
	<netdev@vger.kernel.org>, <kernel-team@fb.com>
Subject: Re: [PATCH 2/5 net-next] inet: kill smallest_size and smallest_port
Date: Wed, 21 Dec 2016 14:32:33 -0500	[thread overview]
Message-ID: <1482348753.24490.14@smtp.office365.com> (raw)
In-Reply-To: <20161221.133003.1401543777326711002.davem@davemloft.net>

On Wed, Dec 21, 2016 at 1:30 PM, David Miller <davem@davemloft.net> 
wrote:
> From: Josef Bacik <jbacik@fb.com>
> Date: Tue, 20 Dec 2016 15:07:01 -0500
> 
>>  In inet_csk_get_port we seem to be using smallest_port to figure 
>> out where the
>>  best place to look for a SO_REUSEPORT sk that matches with an 
>> existing set of
>>  SO_REUSEPORT's.  However if we get to the logic
>> 
>>  if (smallest_size != -1) {
>>  	port = smallest_port;
>>  	goto have_port;
>>  }
>> 
>>  we will do a useless search, because we would have already done the
>>  inet_csk_bind_conflict for that port and it would have returned 1, 
>> otherwise we
>>  would have gone to found_tb and succeeded.  Since this logic makes 
>> us do yet
>>  another trip through inet_csk_bind_conflict for a port we know 
>> won't work just
>>  delete this code and save us the time.
>> 
>>  Signed-off-by: Josef Bacik <jbacik@fb.com>
> 
> So the "all else being equal, use 'tb' with smallest socket count" 
> logic
> wasn't being used at all?
> 
> Instead of removing it why don't we make it work properly again?  
> Something
> obviously broke it somewhere along the line, because I am pretty sure 
> this
> heuristic worked at some point in the past.

Yeah as soon as we would find a tb with no bind conflicts we'd 
immediately jump to found_tb: and subsequently exit, so if we did 
manage to get to the point of checking smallest_size it would be 
redundant as we would have had to hit a bind conflict for that port to 
even reach that code.

How do you want me to add it back?  The logic only kicked in if we were 
SO_REUSEPORT with snum == 0, but Tom tells me that is basically 
useless, so we've disallowed that behavior.  Should we call a 
bind_conflict() for every port and then go back and pick the one with 
the smallest tb?  That's a lot of scanning.  Can you tell me what 
behavior you desire and I'll add another patch to reintroduce it?  
Thanks,

Josef

  parent reply	other threads:[~2016-12-21 19:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 20:06 [RFC][PATCH 0/5 net-next] Rework inet_csk_get_port Josef Bacik
2016-12-20 20:07 ` [PATCH 1/5 net-next] inet: replace ->bind_conflict with ->rcv_saddr_equal Josef Bacik
2016-12-21 15:06   ` Hannes Frederic Sowa
2016-12-21 15:16     ` Josef Bacik
2016-12-22 20:00       ` Hannes Frederic Sowa
2016-12-21 15:23   ` Hannes Frederic Sowa
2016-12-21 15:59     ` Josef Bacik
2016-12-21 18:28   ` David Miller
2016-12-20 20:07 ` [PATCH 2/5 net-next] inet: kill smallest_size and smallest_port Josef Bacik
2016-12-21 18:30   ` David Miller
2016-12-21 19:29     ` Eric Dumazet
2016-12-21 19:32     ` Josef Bacik [this message]
2016-12-20 20:07 ` [PATCH 3/5 net-next] inet: don't check for bind conflicts twice when searching for a port Josef Bacik
2016-12-21 15:08   ` Hannes Frederic Sowa
2016-12-21 15:12     ` Josef Bacik
2016-12-20 20:07 ` [PATCH 4/5 net-next] inet: split inet_csk_get_port into two functions Josef Bacik
2016-12-20 20:07 ` [PATCH 5/5 net-next] inet: reset tb->fastreuseport when adding a reuseport sk Josef Bacik
2016-12-21 16:49   ` 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=1482348753.24490.14@smtp.office365.com \
    --to=jbacik@fb.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=hannes@stressinduktion.org \
    --cc=kernel-team@fb.com \
    --cc=kraigatgoog@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.com \
    /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).