RFC: replace jhash2 with xxhash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux