From patchwork Tue Oct 23 18:25:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timofey Titovets X-Patchwork-Id: 10653469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 666B713A9 for ; Tue, 23 Oct 2018 18:26:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F1542A312 for ; Tue, 23 Oct 2018 18:26:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D7D92A31F; Tue, 23 Oct 2018 18:26:25 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 647B62A312 for ; Tue, 23 Oct 2018 18:26:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DD946B000A; Tue, 23 Oct 2018 14:26:23 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 48DE26B000C; Tue, 23 Oct 2018 14:26:23 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37E186B000D; Tue, 23 Oct 2018 14:26:23 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by kanga.kvack.org (Postfix) with ESMTP id D3E1F6B000A for ; Tue, 23 Oct 2018 14:26:22 -0400 (EDT) Received: by mail-wm1-f70.google.com with SMTP id c13-v6so397664wmb.8 for ; Tue, 23 Oct 2018 11:26:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:mime-version:content-transfer-encoding; bh=bxbWLN+iKZkf34tbKmaCBiV5KewIp0K40jZ4n4WTIfM=; b=Fvs0ldrQFfSrEirK3EigC6aWgd26p0ltWA6jnmKqEAZhI+ms5UbJMxvpMrx0694wID UCW8XIGbNUfJ0BhQTcFfwNTg4FdBtucip4t6BwsDTUECcvXPC6IjU8Jw03VkgeZYIbVw cu8QatfJyz+D83kdhLxtiiH/P8LKKwq3QVHunlPeV7MDm+xAFAGqAe0qmYTmb6EX0+uf XQk/YYB8Vu4dUwXZc1bf/fDkUPTxGOCS92w1UFd8nZA6dbwxqL6ocKMIHuPG/tQeb7+A dpZGiw3apXUhpnoCFcsU76nDpkWdTMvAZu79NrlQ+FlMsLBnNxR7C06+sKf9p/H50tF4 Ellw== X-Gm-Message-State: AGRZ1gIFpFIkCaVMPI31L4ZYpOcqitE8h76wbElTT2jS9uq2YP0R+ujE 2H1oAohV6vlSq3dg/bdtk92F3/8qYa2jmanQCgJSavK5yVOWtDkdbaESAbzJJMybF2GZpfcPtgi HlUHHj+em5gXiGQUh1SZ3zSnL99flVDXipu57ULgvmCjCA8/9c9dB9OcMe2jHhWQRuHWaPqqNm2 nB3djMBe1y4KazXDZZmGEM5OSi3mps84s7Zgp3+3hD+FXFOyM6urX6JLZNQXF49uRLX4PcUKNk9 iBizM/t+FMswJ6cizidSlYIGJn8YCZkmYqb8IYImED1+Z4UxFY/Va0cMJxwIRUmWrbpves2P8Xz tqPp+YiNhS4XzA2t7XG74H3RE5uln1knzcuMb3PXCV9mniUhS0Njc9gkuZoMOskwGPvEaXtdKzu a X-Received: by 2002:adf:83e3:: with SMTP id 90-v6mr3979439wre.278.1540319182166; Tue, 23 Oct 2018 11:26:22 -0700 (PDT) X-Received: by 2002:adf:83e3:: with SMTP id 90-v6mr3979363wre.278.1540319180941; Tue, 23 Oct 2018 11:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540319180; cv=none; d=google.com; s=arc-20160816; b=kdDBZDP63uCPf0M3+WpZY0xZuLVwJ0rnTu4TaM8D/oNx7Hq7obfBcF7K44VK6rW7Xl EvKUmpG7bur08sLId7818kw9Kx6OYk6K8Il7vCFRY4TbTHgqVlhZzfo0uLmctnPUyFQr qjOKqOhQcetckyCLbaDbif7pLt3zqDjUmMnHjbJktXCLc5xDI7FxixopjsR3rEJvPI8y cqemVKfGLrs/iUT7rVJ2U9qZrJSTgB/kaYgWNtRsL6Yp1bVfgLLPqlGfuS/IcHxxG044 oQpY51i7V4uc2rHm1A3dTOzkJ4z5L/CePnjpBqbm5ZI8Jq1Tgw59SNjezqBwBcLMG4aP Zd2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=bxbWLN+iKZkf34tbKmaCBiV5KewIp0K40jZ4n4WTIfM=; b=Smv6kquzF3e7RmiDElQ9dbdL2rhQ45c7Vl3ajXaRBoCfOFRZMgRk5g33DXRqcu6NGH NdhAw+ol7hF3pRu7D3CFRn287nc+dSvr0VUDKMuPlDAbbbRfFcLU6EJSgkKNv4Ra2K04 i/tjBBvnC4xPZ0fALzu0iCxFzUaeFH2zEoP5HrQq0cLyPLG6hXQWeJ3jK3FmJnAkBriL APoaykyOw290c18GA+O5C1SsxEooxgxRJCQ6Y3X5lC/YzMnzx/gnKJ72mgIpCFhj0Ccj YS2wCKsJ5d8vXPv2rwKjFXyYB6RJufeq54dJR5PeZYgBKQKirpEUC+/wB4uxfRfdJCEF kexQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UN5E9eJ3; spf=pass (google.com: domain of nefelim4ag@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=nefelim4ag@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id p127-v6sor1700527wmd.28.2018.10.23.11.26.20 for (Google Transport Security); Tue, 23 Oct 2018 11:26:20 -0700 (PDT) Received-SPF: pass (google.com: domain of nefelim4ag@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UN5E9eJ3; spf=pass (google.com: domain of nefelim4ag@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=nefelim4ag@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bxbWLN+iKZkf34tbKmaCBiV5KewIp0K40jZ4n4WTIfM=; b=UN5E9eJ3eDQz/oj0L8tAne3miCPbqpm6UqJj4xRF/xd7GWt3yRBR7VvGuk1HWKDTuY gp86iuCrDUMvHY4bhILQQXYfIRqJ8bv5WezyLjNOUlFQjR2DbBD7wMpPkQ42iga6OnjI MagsAGN4MtuOXpvna84mpzy2SqCJVXCHELPZP+tgwzwKEBrmlGaOFqO0UtndveXKxdZT aXO1hpZ61YEW+woOxI1Y+UpSaKl6aEARktenCnSxE89AFbWGF1yhGmrDHRxH5Q/o23Mp wRBnu9+5KsO2pZb8Fg0cFVBadQqQ2MnS3+6UWG7Sgyx4hPi74/pm4L9+koRl68f5eXJd KrIw== X-Google-Smtp-Source: ACcGV63rGvbYv0SxxDvDDZb8oRi9oerxKBCQTzG/7z11bv1WU0Slp8R9KGUGz2y35WWuKE2UAZ7jjA== X-Received: by 2002:a1c:5702:: with SMTP id l2-v6mr19900587wmb.83.1540319180016; Tue, 23 Oct 2018 11:26:20 -0700 (PDT) Received: from TitovetsT.synesis.local ([86.57.155.118]) by smtp.gmail.com with ESMTPSA id x16-v6sm2442551wro.28.2018.10.23.11.26.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Oct 2018 11:26:19 -0700 (PDT) From: Timofey Titovets To: linux-mm@kvack.org Cc: Timofey Titovets , Andrea Arcangeli , kvm@vger.kernel.org, leesioh Subject: [PATCH RESEND V8 0/2] Currently used jhash are slow enough and replace it allow as to make KSM Date: Tue, 23 Oct 2018 21:25:52 +0300 Message-Id: <20181023182554.23464-1-nefelim4ag@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Timofey Titovets About speed (in kernel): ksm: crc32c hash() 12081 MB/s ksm: xxh64 hash() 8770 MB/s ksm: xxh32 hash() 4529 MB/s ksm: jhash2 hash() 1569 MB/s By sioh Lee tests (copy from other mail): Test platform: openstack cloud platform (NEWTON version) Experiment node: openstack based cloud compute node (CPU: xeon E5-2620 v3, memory 64gb) VM: (2 VCPU, RAM 4GB, DISK 20GB) * 4 Linux kernel: 4.14 (latest version) KSM setup - sleep_millisecs: 200ms, pages_to_scan: 200 Experiment process Firstly, we turn off KSM and launch 4 VMs. Then we turn on the KSM and measure the checksum computation time until full_scans become two. The experimental results (the experimental value is the average of the measured values) crc32c_intel: 1084.10ns crc32c (no hardware acceleration): 7012.51ns xxhash32: 2227.75ns xxhash64: 1413.16ns jhash2: 5128.30ns In summary, the result shows that crc32c_intel has advantages over all of the hash function used in the experiment. (decreased by 84.54% compared to crc32c, 78.86% compared to jhash2, 51.33% xxhash32, 23.28% compared to xxhash64) the results are similar to those of Timofey. But, use only xxhash for now, because for using crc32c, cryptoapi must be initialized first - that require some tricky solution to work good in all situations. So: - Fisrt patch implement compile time pickup of fastest implementation of xxhash for target platform. - Second replace jhash2 with xxhash Thanks. CC: Andrea Arcangeli CC: linux-mm@kvack.org CC: kvm@vger.kernel.org CC: leesioh Timofey Titovets (2): xxHash: create arch dependent 32/64-bit xxhash() ksm: replace jhash2 with xxhash include/linux/xxhash.h | 23 +++++++++++++++++++++++ mm/Kconfig | 1 + mm/ksm.c | 4 ++-- 3 files changed, 26 insertions(+), 2 deletions(-)