netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Bernat <vincent@bernat.im>
To: Julian Anastasov <ja@ssi.bg>
Cc: Wensong Zhang <wensong@linux-vs.org>,
	Simon Horman <horms@verge.net.au>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, lvs-devel@vger.kernel.org
Subject: Re: [PATCH net-next v1] ipvs: fix multiplicative hashing in sh/dh/lblc/lblcr algorithms
Date: Sun, 01 Apr 2018 12:16:10 +0200	[thread overview]
Message-ID: <m3lge7dyfp.fsf@luffy.cx> (raw)
In-Reply-To: <alpine.LFD.2.20.1804011037200.1933@ja.home.ssi.bg> (Julian Anastasov's message of "Sun, 1 Apr 2018 11:11:08 +0300 (EEST)")

 ❦  1 avril 2018 11:11 +0300, Julian Anastasov <ja@ssi.bg> :

>> -	return (ntohl(addr_fold)*2654435761UL) & IP_VS_DH_TAB_MASK;
>> +	return ((ntohl(addr_fold)*2654435761U) >>
>> +		(32 - IP_VS_DH_TAB_BITS)) &
>> +		IP_VS_DH_TAB_MASK;
>
> 	Looks like the '& mask' part is not needed, still,
> it does not generate extra code. I see that other code uses
> hash_32(val, bits) from include/linux/hash.h but note that it
> used different ratio before Linux 4.7, in case someone backports
> this patch on old kernels. So, I don't have preference what should
> be used, may be return hash_32(ntohl(addr_fold), IP_VS_DH_TAB_BITS)
> is better.

I didn't notice this macro. I think this is a better option. Let me
amend the patch.
-- 
Don't stop with your first draft.
            - The Elements of Programming Style (Kernighan & Plauger)

  reply	other threads:[~2018-04-01 10:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-31 22:28 [PATCH net-next v1] ipvs: fix multiplicative hashing in sh/dh/lblc/lblcr algorithms Vincent Bernat
2018-04-01  8:11 ` Julian Anastasov
2018-04-01 10:16   ` Vincent Bernat [this message]
2018-04-01 10:27   ` [PATCH net-next v2] " Vincent Bernat
2018-04-01 11:11     ` Julian Anastasov
2018-04-09  7:16       ` Simon Horman

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=m3lge7dyfp.fsf@luffy.cx \
    --to=vincent@bernat.im \
    --cc=davem@davemloft.net \
    --cc=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=wensong@linux-vs.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).