Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp204301pxv; Wed, 14 Jul 2021 01:58:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7PAX2+bTrWnOqi4GCPCCeOOc386YBVk90T6tBEQqX+LIsZGskUfnkza0UssDXQlTbu9KV X-Received: by 2002:a17:906:b301:: with SMTP id n1mr10927682ejz.271.1626253119349; Wed, 14 Jul 2021 01:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626253119; cv=none; d=google.com; s=arc-20160816; b=kho3v87WaLRte2CN0gI9ZUDttXOlCbureKbbhC3si8aOaLxiTvGVYCjNFRGEOVSkXX 8duVx7YJGkAckDn44BjNptS5x6gVj+ixz56zgzUqIUqNgV1IaDFKgXtnbNLBHyYOcqLL ly4Ufg06v3WozgUuMYB4stv87H/Byz0gKoX8ARG6oAgPfUGDX7dht5WBze29bw43fRvQ qqPLIdf7G8T384QQWG7SitCzXpjf+50Mek3F4B+hFHNFWGewnUYddZKja+BRANQKJAH4 BotfOMZ4umVAmLB8zE1SHYot1jk8XwYakPotCdxsDD1dMuX8ZXQV7DXFTGbJ0YZQeKn1 BeoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=8Vx+BB0NWwYoN1KcParFH+Gpc5QD5LN7UUlbl1lSPJo=; b=p44rIw8Jn55PYNlG714vi/jg/Y8kiLKRiZNPJNnt2Q2tGejvBl7Zm9D+BovYtt1JEj 7RGchLzMwRXIg0H6rfJUiwEDWhSU++1x7rvpn2mZurUqqB8hlpkg/ltVMqFXkKpzo9hi oh/6/FL03sEU/HvSaagrd3pLs6IXcpRqkOwLk6F9wkMjnXp/KLmsDG3atjKsF1XJFFpJ IBGHAyMil+113sBEA9CnWzLa/PZRm2HrDqIpBUAOxS1I9dQcs1ivzzuTt0fgxEjJd3hJ NMK+s2decrOPU5PNZCAZEepJgR1pv/Q4gO01nM9SqV6RZIKfWsnj1+02U9yyx7JWxndz 1ReQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="owC/sHRD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si2209546edr.231.2021.07.14.01.58.13; Wed, 14 Jul 2021 01:58:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="owC/sHRD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238702AbhGNI7B (ORCPT + 99 others); Wed, 14 Jul 2021 04:59:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238522AbhGNI66 (ORCPT ); Wed, 14 Jul 2021 04:58:58 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5D22C06175F; Wed, 14 Jul 2021 01:56:06 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id a18so2335207lfs.10; Wed, 14 Jul 2021 01:56:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=8Vx+BB0NWwYoN1KcParFH+Gpc5QD5LN7UUlbl1lSPJo=; b=owC/sHRDvmMulhPFKuXa35tdAWl/Ge7OoTGG3fnAvVkHhDvcBQXcrkLlniRv+t3J6g Aw3pW5XofOxn/HpPSUXHGG85gI9PsTkbcfls+Ht59F6iFixImvOTSPIwXY3bIPNpf9dB ACGeWo5zeIjDd4uyIgCIUFvI+p9AUf7R7AghmI2Uq73YtABz/L2QaseyKM6oE256GUrW U59Q/865G/N2t8LU39T60cUj9LmzmDKlKaLutAJUvTrLNJO8ZwJNCUsD5h/ggcqgCeI6 OrJgNihPwKVyOiY7oQRv1poeAU3/qHdjm07sobOljJF66kY3uuFM0c0JRpWx8A40scou Ijjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=8Vx+BB0NWwYoN1KcParFH+Gpc5QD5LN7UUlbl1lSPJo=; b=Ism63kXMl/SXM5E5lgSzn1a2Bky6HPyI/88jLl7n4vINufVYZ1dlrp0Fh5bKaM5/wK IpzzTPNBYfNGwC01cJOdpjN//+8uIlU7JMLuYfWs3vXvP1ym32uXNaF0r/OsWOJiP62H CNYlb8QrYcuMK7aH/igNoXSw+JdI1/OPI3Qz0Mlw6JteeN9mFiZdTQfIbMj3gbJKsA85 +sir42E/piss3HhDqTK37Gc36+hp7bGmekSbjeOD3xqLdNxLkzUP5JL1FOcf9vra66aT 08e2VG6QNFkEX3oYrr65CQyz0wFebSBfevonM1aQqj0GCF7tQFppTzOmJDl4SlPzvPS0 J8Aw== X-Gm-Message-State: AOAM5337MSk9lFsql8ZZG8G/7faHxYrTUxdRXh2zpm66eXMSfHslEJGf dVXpcO6oReOkUV9Tw0+gd/VzIhZh79VNKA== X-Received: by 2002:a05:6512:c12:: with SMTP id z18mr7537642lfu.230.1626252964999; Wed, 14 Jul 2021 01:56:04 -0700 (PDT) Received: from asus ([93.95.240.58]) by smtp.gmail.com with ESMTPSA id v10sm165598ljp.20.2021.07.14.01.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 01:56:04 -0700 (PDT) Date: Wed, 14 Jul 2021 14:56:01 +0600 From: Zhansaya Bagdauletkyzy To: shuah@kernel.org, akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, tyhicks@linux.microsoft.com, pasha.tatashin@soleen.com Subject: [PATCH v2 0/4] add KSM selftests Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce selftests to validate the functionality of KSM. The tests are run on private anonymous pages. Since some KSM tunables are modified, their starting values are saved and restored after testing. At the start, run is set to 2 to ensure that only test pages will be merged (we assume that no applications make madvise syscalls in the background). If KSM config not enabled, all tests will be skipped. Zhansaya Bagdauletkyzy (4): selftests: vm: add KSM merge test selftests: vm: add KSM unmerge test selftests: vm: add KSM zero page merging test selftests: vm: add KSM merging across nodes test v1 -> v2: - add a test to check KSM unmerging - add a test to check merging of zero pages - add a test to check merging in different NUMA nodes - include command line options for each test - new options to specify use_zero_pages and merge_across_nodes - run each test case in run_vmtests.sh - add some helper functions to make the code more compact: allocate_memory(), ksm_do_scan(), ksm_merge_pages() tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile | 3 + tools/testing/selftests/vm/ksm_tests.c | 516 ++++++++++++++++++++++ tools/testing/selftests/vm/run_vmtests.sh | 96 ++++ 4 files changed, 616 insertions(+) create mode 100644 tools/testing/selftests/vm/ksm_tests.c -- 2.25.1