From patchwork Mon Sep 25 08:46:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 9969461 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E9ABB602D8 for ; Mon, 25 Sep 2017 08:46:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E13C720090 for ; Mon, 25 Sep 2017 08:46:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D62D6283C9; Mon, 25 Sep 2017 08:46:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 752AB20090 for ; Mon, 25 Sep 2017 08:46:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753912AbdIYIqm (ORCPT ); Mon, 25 Sep 2017 04:46:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34844 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753893AbdIYIq1 (ORCPT ); Mon, 25 Sep 2017 04:46:27 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v8P8ifZB195733 for ; Mon, 25 Sep 2017 04:46:27 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2d6txwcuu5-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 25 Sep 2017 04:46:25 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 25 Sep 2017 09:46:23 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 25 Sep 2017 09:46:18 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v8P8kIOO21430392; Mon, 25 Sep 2017 08:46:18 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 598E5AE051; Mon, 25 Sep 2017 09:41:03 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E7AF8AE053; Mon, 25 Sep 2017 09:41:02 +0100 (BST) Received: from p-imbrenda.boeblingen.de.ibm.com (unknown [9.152.224.114]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 25 Sep 2017 09:41:02 +0100 (BST) From: Claudio Imbrenda 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 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506329174-19265-1-git-send-email-imbrenda@linux.vnet.ibm.com> References: <1506329174-19265-1-git-send-email-imbrenda@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17092508-0012-0000-0000-0000057BD050 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092508-0013-0000-0000-000018F51853 Message-Id: <1506329174-19265-3-git-send-email-imbrenda@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-25_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709250137 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 +#include +#include + +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