linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>, Greg Thelen <gthelen@google.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH] trace-cmd: remove ununsed knuth_hash*() routines
Date: Thu, 27 Jun 2019 18:40:27 +0300	[thread overview]
Message-ID: <550e11ae-1ac1-dbee-e88b-e62f63a6d032@gmail.com> (raw)
In-Reply-To: <20190626153401.645b1174@gandalf.local.home>



On 26.06.19 г. 22:34 ч., Steven Rostedt wrote:
> On Tue, 25 Jun 2019 23:01:01 -0700
> Greg Thelen <gthelen@google.com> wrote:
> 
>> Neither knuth_hash16() nor knuth_hash() are used.
>> Delete them.
>>
> 
> Yordan,
> 
> Do you foresee that we will be using the other two versions of the hash?
> 
> -- Steve
> 

Hi Greg,

Thanks for the fix!

I agree that we have to remove the unused hashing functions, but may I 
ask you to do a little bit of extra work here.
I think that if we are going to keep only one hashing function this 
function can be called simply knuth_has (not knuth_has8).

Also the comment on top which refers to the TAOCP book must be modified 
stating that the original idea from the book (32 bit hash) was adapted 
in order to be used for small tables.

cheers,
Yordan


PS: I just saw couple of new patches coming from you and I want to say 
that your help is more than welcome.



>> Signed-off-by: Greg Thelen <gthelen@google.com>
>> ---
>>   lib/trace-cmd/trace-filter-hash.c | 20 --------------------
>>   1 file changed, 20 deletions(-)
>>
>> diff --git a/lib/trace-cmd/trace-filter-hash.c b/lib/trace-cmd/trace-filter-hash.c
>> index 39b28790e0bc..c56628f69ff0 100644
>> --- a/lib/trace-cmd/trace-filter-hash.c
>> +++ b/lib/trace-cmd/trace-filter-hash.c
>> @@ -29,26 +29,6 @@ static inline uint8_t knuth_hash8(uint32_t val)
>>   	return UINT8_C(val) * UINT8_C(157);
>>   }
>>   
>> -static inline uint16_t knuth_hash16(uint32_t val)
>> -{
>> -	/*
>> -	 * Multiplicative hashing function.
>> -	 * Multiplication by the Prime number, closest to the golden
>> -	 * ratio of 2^16.
>> -	 */
>> -	return UINT16_C(val) * UINT16_C(40507);
>> -}
>> -
>> -static inline uint32_t knuth_hash(uint32_t val)
>> -{
>> -	/*
>> -	 * Multiplicative hashing function.
>> -	 * Multiplication by the Prime number, closest to the golden
>> -	 * ratio of 2^32.
>> -	 */
>> -	return val * UINT32_C(2654435761);
>> -}
>> -
>>   struct tracecmd_filter_id_item *
>>   tracecmd_filter_id_find(struct tracecmd_filter_id *hash, int id)
>>   {
> 

  reply	other threads:[~2019-06-27 15:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26  6:01 [PATCH] trace-cmd: remove ununsed knuth_hash*() routines Greg Thelen
2019-06-26 19:34 ` Steven Rostedt
2019-06-27 15:40   ` Yordan Karadzhov (VMware) [this message]
2019-06-27 16:15     ` Steven Rostedt
2019-06-28 15:55       ` Greg Thelen
2019-06-29  6:27       ` [PATCH v2] " Greg Thelen
2019-07-01 12:23         ` Yordan Karadzhov (VMware)
2019-07-05 13:31         ` Steven Rostedt

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=550e11ae-1ac1-dbee-e88b-e62f63a6d032@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=gthelen@google.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.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).