❦ 1 avril 2018 11:11 +0300, Julian Anastasov <ja@xxxxxx> :
>> - 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)
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
|