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 15EA5C07CA9 for ; Tue, 28 Nov 2023 16:51:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B03C6B027E; Tue, 28 Nov 2023 11:51:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 860156B0281; Tue, 28 Nov 2023 11:51:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 701076B02FF; Tue, 28 Nov 2023 11:51:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 60ECE6B027E for ; Tue, 28 Nov 2023 11:51:39 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3AB761602AE for ; Tue, 28 Nov 2023 16:51:39 +0000 (UTC) X-FDA: 81507954318.13.C7DE525 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf02.hostedemail.com (Postfix) with ESMTP id 03AB080017 for ; Tue, 28 Nov 2023 16:51:36 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=Jb2teBF2; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="F/50VQ+Y"; spf=pass (imf02.hostedemail.com: domain of pvorel@suse.cz designates 195.135.223.131 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=1701190297; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PQpBwf7aRZ7lwl0TCI+2eHpTa52Fp4ME7dR2NN2+mUQ=; b=YCiMc+DvJ6MsQDHwy6NE96HF+7d7kjq6nHMV0wxD608ZrrnumA2Dc2b0BZoeV+Hk4NAJh0 RzADSKImpagpuuaV1OhGUeOjqcU/h4RrISxtCEPEC50hMnRrmKtWCnAAW9F/OPeF3s5o4E ieR8jrMq9a04hTp/22Teun2sfTur5D0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701190297; a=rsa-sha256; cv=none; b=TFkxdw5zljLntY1ZQyiEwugv6DzN1m8/s8jNRfem1/oRW1S99OGPfHqGcU2cZh/4N/BUhO yT1uj7mk6V3jopp+pmi3lp74hT5C4cM6NyAKR4q1Cp3LiLltv4FMhY9Szt5O0V7p0cx2Gj 4jRDUcg8mtVi+cXSjxmZz2OmAbEqq5w= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=Jb2teBF2; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="F/50VQ+Y"; spf=pass (imf02.hostedemail.com: domain of pvorel@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=pvorel@suse.cz; dmarc=none Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [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-out2.suse.de (Postfix) with ESMTPS id 0B75F1F899; Tue, 28 Nov 2023 16:51:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1701190295; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PQpBwf7aRZ7lwl0TCI+2eHpTa52Fp4ME7dR2NN2+mUQ=; b=Jb2teBF2pL8O7JSdSkxkjSkrN3NLA6mbgeVVnJyeefzotGz9FQZtV91guECkQrIuD1ovuF 0STwvx9js+ETZd0xux7zvjvwRgytrN/0ZNwU7f4FbaxaJ8RQ1TWGHFzyxUkHw/9ezIUKIG veZpKOciYnwGn4lVZT3gIQZ7hNve6qI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1701190295; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PQpBwf7aRZ7lwl0TCI+2eHpTa52Fp4ME7dR2NN2+mUQ=; b=F/50VQ+YDATuuz2vXHLftlF0/EcpvgzAT7JVJlJ5yVTLYMhs7wkrqi6FYdoyIR/ah7T3w1 jWyIgaxPTeZVPzBQ== 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 C19F6139FC; Tue, 28 Nov 2023 16:51:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id HUozLpYaZmVfXwAAn2gu4w (envelope-from ); Tue, 28 Nov 2023 16:51:34 +0000 Date: Tue, 28 Nov 2023 17:51:32 +0100 From: Petr Vorel To: Li Wang Cc: Stefan Roesch , kernel-team@fb.com, linux-mm@kvack.org, david@redhat.com, oliver.sang@intel.com, ltp@lists.linux.it Subject: Re: [LTP] [PATCH v1] mem: disable KSM smart scan for ksm tests Message-ID: <20231128165132.GA406520@pevik> Reply-To: Petr Vorel References: <20231127174517.2369593-1-shr@devkernel.io> <20231128074626.GA298624@pevik> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 03AB080017 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: kj6xub8bm3wyxzfqnzweoahysqpxiqo3 X-HE-Tag: 1701190296-556496 X-HE-Meta: U2FsdGVkX1/rQUsRggCR7fnH6HdqM/eMK7bvqRjecLHOJP+yNMb/HUSOECVQENbAma3/jv5zqb4C/UkAvvtzbntX9km9W93H80sYRUMXc8UIiLKnrcXmreOS0f/s04s+XoHuvh6Hv87z4hbb3/wIZCRLNZalemOB/AceiBRpZsufS0UUhMBkG93Lhg6+X4CxiYBGFR+4c6Sy0258tx7lDFGSltJ1SEMKJJGoIEACW9AImUF6lO46i+s040Bqam8FrZEPBz0/1HjopGDlmy+iyYlEwhWAtvtpx8GWdLHZ3v8+01vaJjQxr9GVfJddhPREyFlZOGyMZsGliF+1qzsuBojUYKktQ7Y1b9REutM6Ym8+vrMWH3bAbJN6DH5gS0vUyax6zuWIdA6841YuV7frWzEBbTHaWU9eVhv+9887MkiqtcHKdDHph+lwUmzy8MR4N0yfLLUhFAodlr2uDVeng//78+vo1Byw1PxXxQvraY6m9Vafph7V0I6P1Vmro2HYKyUsjbfdqRpB+7JMqUZvUbomk2jTKT+d1SkTd+vbNOTamXiI4kLS4rMxdJ9c5qeAJlyn8hwNpUGcVRJfJSi5itxYeExnlhbx2NN2v35/Drw9gAiIQ6wmEt/wdvXFZjE5c7PbO7WVeBmkR3OsrnO8nHWhq25uBCQiyGkDQ86drv6DNeDa5I3JdZtzuCu7YLujlj3zv/dEh0GHNi7jcbG6PnLJfT4CVWcxCEYrvWq+wMwdwrBHlNhlEivaZH2F3bwm7gZ+bXx4dhSIdlKH7OVMgkz3e7HU9A2pe/Jimd1mvrjQQHwwqTICqONHil5cstU2u2Y46g34lpNVC9RuZQPIzfunU/PzxjZpco8lguTGS5UMd/3hOfZxFJ9MfjX7ZgljvSMAvT5hSyAFFU3ybZbS3Gw2kMtRg0cuF4vhn94s7JhMTEaFWIb+72s26JayjkKhGumSSVRFL+jkW3azH1l sqfpZFEP En19Jmo3HE2QL7k1O6EXioKSld+148Cq34SY3PlVZbJ0G5z41/YBnfA/v7OML88GJJArcOt/+ea3EUB5dYxQjljSx9drJQdXHKOzFcdgUExZ5QAAZFjH975YhdtDp7oNXL9f5edRD+k41B+lRePy5Ht5FBaowhhnJYAXHwVYQvVXeZBdMeaQR+YqjPrrRfpZv7md+SePT9VJvvVksXdtFc7d6HNLNJ5boPSbFwQOOP4/Ldn8MedEHuPi7ij3MJKSUrpTbvO6lOxw7DRNhDL92tattyXRfUFqtbmZEvkqcB6uD4lPLgSPQgydlgiv2g408QNCW0Pm2wSmc1LpbYfbi7jpncIP0Bty4i7O60bQBaSPOIlco4+ceQMZjN5IEeejkSgMNjgPHOCo6Gds= 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, Li, > Hi Stefan, Petr, > On Tue, Nov 28, 2023 at 3:46 PM Petr Vorel wrote: > > Hi Stefan, > > > This disables the "smart scan" KSM feature to make sure that the volatile > > > count remains at 0. > > > Signed-off-by: Stefan Roesch > > nit: you forgot 'shr@' > > Signed-off-by: Stefan Roesch > > > Reported-by: kernel test robot > > > Closes: > > https://lore.kernel.org/oe-lkp/202311161132.13d8ce5a-oliver.sang@intel.com > > > --- > > > testcases/kernel/mem/lib/mem.c | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > diff --git a/testcases/kernel/mem/lib/mem.c > > b/testcases/kernel/mem/lib/mem.c > > > index fbfeef026..ef274a3ac 100644 > > > --- a/testcases/kernel/mem/lib/mem.c > > > +++ b/testcases/kernel/mem/lib/mem.c > > > @@ -454,6 +454,9 @@ void create_same_memory(int size, int num, int unit) > > > {'a', size*MB}, {'a', size*MB}, {'d', size*MB}, {'d', > > size*MB}, > > > }; > > > + /* Disable smart scan for correct volatile counts. */ > > > + SAFE_FILE_PRINTF(PATH_KSM "smart_scan", "0"); > > NOTE, this fails on the systems without /sys/kernel/mm/ksm/smart_scan: > > mem.c:458: TBROK: Failed to open FILE '/sys/kernel/mm/ksm/smart_scan' for > > writing: EACCES (13) > > NOTE, we normally handle the setup like this in test setup function. > > But new API has .save_restore which is more robust for tasks like this. > > It's already used in ksm01.c, you need just to add this line: > > {"/sys/kernel/mm/ksm/smart_scan", "0", TST_SR_SKIP}, > I guess we need to set 'TST_SR_SKIP_MISSING | TST_SR_TBROK_RO' > as the last field. Because TST_SR_SKIP will continue the test without > writing '0' to the smart_scan file, that's not correct if the file exists. > It will > ignore a kernel bug (smart_scan can't be written) by that config. > Per the Doc Petr pointed below: > TST_SR_SKIP_MISSING – Continue without saving the file if it does not > exist > TST_SR_TBROK_RO – End test with TBROK if the file is read-only > TST_SR_SKIP_RO – Continue without saving the file if it is read-only > TST_SR_SKIP – Equivalent to 'TST_SR_SKIP_MISSING | TST_SR_SKIP_RO' > > (instead of both SAFE_FILE_PRINTF) > > See: > > https://github.com/linux-test-project/ltp/wiki/C-Test-API#127-saving--restoring-procsys-values > > I wonder if ksm01.c is the only ksm test which needs to disable this. > I think all of the ksm0*.c tests should disable it by the config. The > smart_scan > will impact all the tests with invoke key function create_same_memory(). ksm05.c and ksm06.c does not use create_same_memory(). Or did I overlook something? > > also nit: there is a wrong indent (spaces instead of tabs), please be > > consistent > > with the file content. > > NOTE: while this fixes problem on 6.7.0-rc1-2.g86e46c2-default (openSUSE), > > it does not fixes other problem on 6.5.10 on Debian (16 errors like these > > below): > > mem.c:252: TFAIL: pages_shared is not 2 but 5038. > > mem.c:252: TFAIL: pages_sharing is not 98302 but 593629. > > mem.c:252: TFAIL: pages_volatile is not 0 but 391. > > mem.c:252: TFAIL: pages_unshared is not 0 but 149157. > > I have no idea if this is a real bug which needs to be fixed or test false > > positive to be fixed, or whether the problem has already been fixed in > > newer > > kernels. > It is more like a real bug, the Debain kernel-6.5.10 does not contain > this smart_scan feature. Or you may try to build the latest kernel > on your platform to see if it can be reproduced as well. I'll try to reproduce this on mainline kernel 6.5, 6.6 and 6.7. > > > + > > > ps = sysconf(_SC_PAGE_SIZE); > > > pages = MB / ps; > > > @@ -526,6 +529,7 @@ void create_same_memory(int size, int num, int unit) > > > tst_res(TINFO, "stop KSM."); > > > SAFE_FILE_PRINTF(PATH_KSM "run", "0"); > > > + SAFE_FILE_PRINTF(PATH_KSM "smart_scan", "1"); > > nit: Again, wrong indent. You could have seen it also in the generated > > patch. > > Kind regards, > > Petr > > > final_group_check(0, 0, 0, 0, 0, 0, size * pages * num); > > > while (waitpid(-1, &status, 0) > 0) > > > base-commit: 8c89ef3d451087ed6e18750bd5eedd10e5ab3d2e > One more comment not related to this patch: > @Stefan, do you have a test (or plan to) verify the 'smart_scan' feture > works? > As we do disables it for all ksm* tests in LTP, so, it would be great to > have one > for testing in enable mode. What do you think? This makes perfect sense even if I'm not that ksm05.c and ksm06.c also needs to disable smart_scan. Kind regards, Petr