linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Timofey Titovets <nefelim4ag@gmail.com>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH] KSM: Replace jhash2 with xxhash
Date: Thu, 21 Sep 2017 08:36:57 -0700	[thread overview]
Message-ID: <8760ccdpwm.fsf@linux.intel.com> (raw)
In-Reply-To: <20170921074519.9333-1-nefelim4ag@gmail.com> (Timofey Titovets's message of "Thu, 21 Sep 2017 10:45:19 +0300")

Timofey Titovets <nefelim4ag@gmail.com> 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@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>

  reply	other threads:[~2017-09-21 15:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21  7:45 [PATCH] KSM: Replace jhash2 with xxhash Timofey Titovets
2017-09-21 15:36 ` Andi Kleen [this message]
2017-09-21 17:35   ` Timofey Titovets
2017-09-21 20:05     ` Andi Kleen
2017-09-21 21:37       ` Timofey Titovets
2017-09-21 22:06         ` Andi Kleen
2017-09-22  8:44 ` Christian Borntraeger

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=8760ccdpwm.fsf@linux.intel.com \
    --to=ak@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --cc=nefelim4ag@gmail.com \
    /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).