linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* RFC: replace jhash2 with xxhash
@ 2017-09-15 11:46 Timofey Titovets
  2017-09-20 22:03 ` Andi Kleen
  0 siblings, 1 reply; 2+ messages in thread
From: Timofey Titovets @ 2017-09-15 11:46 UTC (permalink / raw)
  To: linux-mm

Hi mm folks,
Recently xxhash has been added in kernel[1]

jhash2 for now (AFAIK) is a lookup3 Jenkins Hash,
in mm subsystem it's used in 2 places:
ksm.c      [2] - for hashing pages
hugetlb.c [3] - hash 4/8 byte value pairs.

I do some reverse porting to userspace (i'm hard to test performance
of that hashes in kernel)
xxhash useless for small keyvalue pairs (read as it's useless to touch
hugetlb.c),
but for PAGE_SIZE'ed data it's much faster

PAGE_SIZE: 4096, loop count: 1048576
jhash2:   0x12a1b130 perf: 1917 ms
xxhash64: 0x297821d3a9243df7 perf: 362 ms
xxhash32: 0xf46b3473 perf: 728 ms

PAGE_SIZE: 16384, loop count: 1048576
jhash2:   0xb73b6438 perf: 7644 ms
xxhash64: 0x360051a038cb61ca perf: 1477 ms
xxhash32: 0xe22e33b5 perf: 2939 ms

PAGE_SIZE: 65536, loop count: 1048576
jhash2:   0x20fb1308 perf: 32441 ms
xxhash64: 0x4a108bab621e8049 perf: 5872 ms
xxhash32: 0xe52eafe perf: 11727 ms

Test cpu: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz

i.e. for KSM that's can make hash much faster, even
may be that make a sense to use 64bit hash if kernel compiled for 64bit target.

Thanks.

P.S.
I can write a patch if you found that useful

P.S.S.
I can push test code to GitHub and add link if needed

[1] For 4.14, commit 5d2405227a9eaea48e8cc95756a06d407b11f141
     https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20170915&id=5d2405227a9eaea48e8cc95756a06d407b11f141
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/ksm.c?h=v4.13#n989
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/hugetlb.c?h=v4.13#n3813
-- 
Have a nice day,
Timofey.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: RFC: replace jhash2 with xxhash
  2017-09-15 11:46 RFC: replace jhash2 with xxhash Timofey Titovets
@ 2017-09-20 22:03 ` Andi Kleen
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2017-09-20 22:03 UTC (permalink / raw)
  To: Timofey Titovets; +Cc: linux-mm

Timofey Titovets <nefelim4ag@gmail.com> writes:
>
> P.S.
> I can write a patch if you found that useful

Seems useful. Please submit a patch.

-Andi

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-20 22:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-15 11:46 RFC: replace jhash2 with xxhash Timofey Titovets
2017-09-20 22:03 ` Andi Kleen

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).