Timofey Titovets <nefelim4ag@xxxxxxxxx> writes: > xxhash much faster then jhash, > ex. for x86_64 host: > PAGE_SIZE: 4096, loop count: 1048576 > jhash2: 0xacbc7a5b time: 1907 ms, th: 2251.9 MiB/s > xxhash32: 0x570da981 time: 739 ms, th: 5809.4 MiB/s > xxhash64: 0xa1fa032ab85bbb62 time: 371 ms, th: 11556.6 MiB/s > > xxhash64 on x86_32 work with ~ same speed as jhash2. > xxhash32 on x86_32 work with ~ same speed as for x86_64 Which CPU is that? > > So replace jhash with xxhash, > and use fastest version for current target ARCH. Can you do some macro-benchmarking too? Something that uses KSM and show how the performance changes. You could manually increase the scan rate to make it easier to see. > @@ -51,6 +52,12 @@ > #define DO_NUMA(x) do { } while (0) > #endif > > +#if BITS_PER_LONG == 64 > +typedef u64 xxhash; > +#else > +typedef u32 xxhash; > +#endif This should be in xxhash.h ? xxhash_t would seem to be a better name. > - u32 checksum; > + xxhash checksum; > void *addr = kmap_atomic(page); > - checksum = jhash2(addr, PAGE_SIZE / 4, 17); > +#if BITS_PER_LONG == 64 > + checksum = xxh64(addr, PAGE_SIZE, 0); > +#else > + checksum = xxh32(addr, PAGE_SIZE, 0); > +#endif This should also be generic in xxhash.h -Andi -- 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>