From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62534C4167B for ; Mon, 4 Dec 2023 10:39:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCA226B0296; Mon, 4 Dec 2023 05:39:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C79D56B0298; Mon, 4 Dec 2023 05:39:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B427A6B0299; Mon, 4 Dec 2023 05:39:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A59B86B0296 for ; Mon, 4 Dec 2023 05:39:56 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7F25F1C031F for ; Mon, 4 Dec 2023 10:39:56 +0000 (UTC) X-FDA: 81528790392.27.FED2FBA Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf17.hostedemail.com (Postfix) with ESMTP id 2463640014 for ; Mon, 4 Dec 2023 10:39:53 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; spf=pass (imf17.hostedemail.com: domain of pvorel@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=pvorel@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701686394; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=juvHxVl34SPmwIlf26Jzb+Z1w/hXTrZE+pZ7c2aynS0=; b=VKpTjnoyWLAG324DXHpGbfi5DG1MKfE2PLbgqrKc2mm8FzyOD5DEr9DEq45xver1kIGFxk PPZObID7T6wIZHNdy9FGwsnJOEFBatd0bnU6Zp8yRUHgnwTTZNufP9RQT17Xoag1axE9oi r41gQMAgt6h8lc//WoE2s9v/nU2luzw= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; spf=pass (imf17.hostedemail.com: domain of pvorel@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=pvorel@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701686394; a=rsa-sha256; cv=none; b=3YRXpeqUvCusb96GjAJ66mwkQrApi0Z7wkDgB7yxp2WXC7RGES+bFWqRDPP9lHp+1BCVdp roH6A6XEwq7OcBajpHQkDd82YZJjVqlJ2/GhlVbp9HlY0avfs2u7AJ9EfzbDvA4ne4zBZy onCbwZZqYnxfkVTcPNGpd0oVPwLAdlo= Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1DC0622062; Mon, 4 Dec 2023 10:39:52 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id E45DE139E2; Mon, 4 Dec 2023 10:39:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id mfwMNnesbWWCRAAAn2gu4w (envelope-from ); Mon, 04 Dec 2023 10:39:51 +0000 Date: Mon, 4 Dec 2023 11:39:50 +0100 From: Petr Vorel To: Stefan Roesch Cc: kernel-team@fb.com, david@redhat.com, oliver.sang@intel.com, linux-mm@kvack.org, ltp@lists.linux.it, liwang@redhat.com Subject: Re: [PATCH v2 2/2] add ksm test for smart-scan feature Message-ID: <20231204103950.GA22019@pevik> Reply-To: Petr Vorel References: <20231201210930.2651725-1-shr@devkernel.io> <20231201210930.2651725-3-shr@devkernel.io> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231201210930.2651725-3-shr@devkernel.io> X-Spamd-Bar: ++++++++++++ X-Rspamd-Queue-Id: 2463640014 X-Rspam-User: X-Stat-Signature: a9ei6zxxtwdiatci3d1b4pfseyyc68gk X-Rspamd-Server: rspam01 X-HE-Tag: 1701686393-746728 X-HE-Meta: U2FsdGVkX19laNqHz5Ib2+0v0sMn1r8ec/zWMRdHXKaaOZU36Ko3XiOkztC1TisEiBQLTWajHn2lktvQkvbjQtyXSviba33m4rw7qAePlXTjI+o4F7ezYTfCR4SsT89xUozv5w3SbOE74rJ89kBdNj1N076dMfVgpuznpE5nQ4nt1CzNh8Pi6GBdcRH1v51Cj2sxwxCwvpwjwx2UcEAM7gl289JW/coG/DGpkz2C5+F/h0sXX/VsAf7VrIkzVnUXRWHimtPFeYPntVuz7402JJJpn4FySr4n+xshhttxYcSR25r7oW8sW2/+91/XvrACbebTOjS8FoiLh+ZOuybibtQQOfsojaUdwkBmA/THAl0hCF1NWGin6qlpZmRYY+kFBjbO9Sq6u0EMJL3MQhMCKq9KI13/MaCdkgmdlksIECp23Lbjm4rDQQ2M+3SXfygITR7BFFjELZSLauECzQ+jSugWh+ABIHUZHLxHv6DkDSO70l6R6pB6EWJFmYw/ElXoPWii0ZY67WWDARcPzFQqlzGyUtt0TTtZqSrNPybNa71ouhG/58Tm64W9ZWbtRSuY13/1GUZwjojfsZomBxI5sOZsLFObl0yxiFgjGgZgP1w44jASSZIuBg4hVDbvITQ1b9gOWi27j2z7uqUotzpBt9argIvOdLS9RavqQIBXJCJgjAHS3YrlupH1ILBmYmudJM9UjbZMgl1WBPZWemIWNSAPek9AQNf257e8bYSK2kKYq00fLaNj35cvQnkBptzRNrohW0gCPKFSHY52vRMmtkoaPFjg7Y0Q1i3dJL3JXhnbJ6gZWXgNcX9NqlBjSh3N1Z+CxvgPH6Q/VnYeY3a/n0nPLKaW4BOUGXplZqIGE4F6DxwOvHDDiRcoUbHuLJ6MIwopkFCHm8SFYCXD5uDhmdKViZXKl8zuTtoHmPQZ+0fslD1VUcP1B2gtfvWO9D9xhhfhoDlRzVVd7/Cf31A yXZARkO3 jAGCVGAxo9YkuKgeE0ANOXD+l634LZDtFfx1Pk31dHHg4tbMjDrP6Lx71UvJxwBUlmVr6wKfh0TuTUl3sXjF1+drtQ2lFUxcRe+hXZr+6dI/powuieelsYkOaq11k1sTAEF9IwirCybm2p4r6ionp7x76P57TkU7FjlQtxJ263b44caA248P48zwfkBMlRYu0eFDax5lC4BEuDBausCriMRBMF7+uSDg9w721ASLyTvvG9t8apsChVzR2dHRK0c1l26tB+F7sWhaJ1mFhB41DpKrvLG71f1YmeXcB 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: List-Subscribe: List-Unsubscribe: Hi Stefan, ... > +++ b/testcases/kernel/mem/ksm/ksm07.c > @@ -0,0 +1,69 @@ > +/* > + * Copyright (C) 2010-2017 Red Hat, Inc. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See > + * the GNU General Public License for more details. NOTE: we use SPDX instead of verbose GPL (see ksm06.c). > + * NOTE: we have special doc format which starts like this (see ksm06.c): /*\ * [Description] * * ... > + * Kernel Samepage Merging (KSM) > + * > + * This adds a new ksm (kernel samepage merging) test to evaluate the new > + * smart scan feature. It allocates a page and fills it with 'a' > + * characters. It captures the pages_skipped counter, waits for a few > + * iterations and captures the pages_skipped counter again. The expectation > + * is that over 50% of the page scans are skipped (There is only one page > + * that has KSM enabled and it gets scanned during each iteration and it > + * cannot be de-duplicated). > + * > + * Prerequisites: > + * > + * 1) ksm and ksmtuned daemons need to be disabled. Otherwise, it could > + * distrub the testing as they also change some ksm tunables depends > + * on current workloads. Hm, we don't have to any helper in LTP API to detect this, so at least we document this. > + * > + */ The result is then uploaded: https://github.com/linux-test-project/ltp/releases/download/20230929/metadata.20230929.html Therefore please use: // SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2010-2017 Red Hat, Inc. */ /*\ * [Description] * * Kernel Samepage Merging (KSM) * * This adds a new ksm (kernel samepage merging) test to evaluate the new * smart scan feature. It allocates a page and fills it with 'a' * characters. It captures the pages_skipped counter, waits for a few * iterations and captures the pages_skipped counter again. The expectation * is that over 50% of the page scans are skipped (There is only one page * that has KSM enabled and it gets scanned during each iteration and it * cannot be de-duplicated). * * Prerequisites: * * 1) ksm and ksmtuned daemons need to be disabled. Otherwise, it could * distrub the testing as they also change some ksm tunables depends * on current workloads. */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include "../include/mem.h" > +#include "ksm_common.h" > + > +static void verify_ksm(void) > +{ > + create_memory_for_smartscan(); I wonder, if we reusable create_memory_for_smartscan() later. Maybe it should be put into ksm07 for the start. Also, the test needs to run on older kernel - exit with TCONF (which is not considered as a failure) instead of TBROK which does now: mem.c:488: TBROK: Failed to open FILE '/sys/kernel/mm/ksm/pages_skipped' for reading: ENOENT (2) If the testing code stays in testcases/kernel/mem/lib/mem.c, you will have to stat() it. But if it's really just this test specific and you move it to ksm07.c, then you can simply add the handling via .save_restore. > +} > + > +static struct tst_test test = { > + .needs_root = 1, > + .forks_child = 1, > + .options = (struct tst_option[]) { > + {} > + }, > + .save_restore = (const struct tst_path_val[]) { > + {"/sys/kernel/mm/ksm/run", NULL, TST_SR_TBROK}, > + {"/sys/kernel/mm/ksm/sleep_millisecs", NULL, TST_SR_TBROK}, > + {"/sys/kernel/mm/ksm/smart_scan", "1", > + TST_SR_SKIP_MISSING | TST_SR_TBROK_RO}, > + {} > + }, > + .needs_kconfigs = (const char *const[]){ > + "CONFIG_KSM=y", > + NULL > + }, > + .test_all = verify_ksm, > +}; Also, there are missing static: $ cd testcases/kernel/mem/ksm/; make check-ksm07 CHECK testcases/kernel/mem/ksm/ksm07.c ksm07.c:1: WARNING: Missing or malformed SPDX-License-Identifier tag in line 1 make: [../../../../include/mk/rules.mk:56: check-ksm07] Error 1 (ignored) ksm07.c: note: in included file: ksm_common.h:14:5: warning: Symbol 'size' has no prototype or library ('tst_') prefix. Should it be static? ksm_common.h:14:29: warning: Symbol 'num' has no prototype or library ('tst_') prefix. Should it be static? ksm_common.h:14:38: warning: Symbol 'unit' has no prototype or library ('tst_') prefix. Should it be static? ksm_common.h:15:6: warning: Symbol 'opt_sizestr' has no prototype or library ('tst_') prefix. Should it be static? ksm_common.h:15:20: warning: Symbol 'opt_numstr' has no prototype or library ('tst_') prefix. Should it be static? ksm_common.h:15:33: warning: Symbol 'opt_unitstr' has no prototype or library ('tst_') prefix. Should it be static? Kind regards, Petr