linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: borntraeger@de.ibm.com, kvm@vger.kernel.org, linux-mm@kvack.org,
	nefelim4ag@gmail.com, akpm@linux-foundation.org,
	aarcange@redhat.com, mingo@kernel.org, zhongjiang@huawei.com,
	kirill.shutemov@linux.intel.com, arvind.yadav.cs@gmail.com,
	solee@os.korea.ac.kr, ak@linux.intel.com
Subject: [RFC v1 2/2] VS1544 KSM s390-specific memory comparison functions
Date: Mon, 25 Sep 2017 10:46:14 +0200	[thread overview]
Message-ID: <1506329174-19265-3-git-send-email-imbrenda@linux.vnet.ibm.com> (raw)
In-Reply-To: <1506329174-19265-1-git-send-email-imbrenda@linux.vnet.ibm.com>

Introduce s390 specific page comparison and checksumming functions:

The s390-specific functions use the CKSM instruction to quickly
calculate the checksum of a page.

This provides a measurable reduction on CPU load when KSM is active.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
---
 arch/s390/include/asm/Kbuild        |  1 -
 arch/s390/include/asm/page_memops.h | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 arch/s390/include/asm/page_memops.h

diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index e68b429..b3c8847 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -14,7 +14,6 @@ generic-y += local.h
 generic-y += local64.h
 generic-y += mcs_spinlock.h
 generic-y += mm-arch-hooks.h
-generic-y += page_memops.h
 generic-y += preempt.h
 generic-y += trace_clock.h
 generic-y += word-at-a-time.h
diff --git a/arch/s390/include/asm/page_memops.h b/arch/s390/include/asm/page_memops.h
new file mode 100644
index 0000000..48b829b
--- /dev/null
+++ b/arch/s390/include/asm/page_memops.h
@@ -0,0 +1,18 @@
+#ifndef _ASM_S390_PAGE_MEMOPS_H
+#define _ASM_S390_PAGE_MEMOPS_H
+
+#include <linux/mm_types.h>
+#include <linux/highmem.h>
+#include <asm/checksum.h>
+
+static inline u32 calc_page_checksum(struct page *page)
+{
+	return csum_partial(page_address(page), PAGE_SIZE, 0);
+}
+
+static inline int memcmp_pages(struct page *page1, struct page *page2)
+{
+	return memcmp(page_address(page1), page_address(page2), PAGE_SIZE);
+}
+
+#endif
-- 
2.7.4

  parent reply	other threads:[~2017-09-25  8:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25  8:46 [RFC v1 0/2] Per-arch page checksumming and comparison Claudio Imbrenda
2017-09-25  8:46 ` [RFC v1 1/2] VS1544 KSM generic memory comparison functions Claudio Imbrenda
2017-09-25 10:06   ` Geert Uytterhoeven
2017-09-25  8:46 ` Claudio Imbrenda [this message]
2017-09-25 11:41 ` [RFC v1 0/2] Per-arch page checksumming and comparison Andrea Arcangeli

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=1506329174-19265-3-git-send-email-imbrenda@linux.vnet.ibm.com \
    --to=imbrenda@linux.vnet.ibm.com \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=borntraeger@de.ibm.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=nefelim4ag@gmail.com \
    --cc=solee@os.korea.ac.kr \
    --cc=zhongjiang@huawei.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).