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 C82E3C10F04 for ; Fri, 1 Dec 2023 20:07:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 683528D0074; Fri, 1 Dec 2023 15:07:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 632798D0001; Fri, 1 Dec 2023 15:07:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FA138D0074; Fri, 1 Dec 2023 15:07:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 427BF8D0001 for ; Fri, 1 Dec 2023 15:07:54 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1A1E2A059A for ; Fri, 1 Dec 2023 20:07:54 +0000 (UTC) X-FDA: 81519335268.20.7265984 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by imf13.hostedemail.com (Postfix) with ESMTP id 12C872002B for ; Fri, 1 Dec 2023 20:07:51 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=devkernel.io header.s=fm2 header.b=Dbgqfbas; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=yaDGWL2z; dmarc=none; spf=pass (imf13.hostedemail.com: domain of shr@devkernel.io designates 66.111.4.27 as permitted sender) smtp.mailfrom=shr@devkernel.io ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701461272; h=from:from:sender: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=9XhUjlfuIkMoL0ZK2dbxU2EbPZYrR3D6b5V4nJScxA0=; b=JwdYz5INiy25AIJ0YMhKCqBrgZoN0jLPb9HfBTWtUwN5uQrxaqbWF1H7i2QLh0cQqgLhuK w63BTUGz8DUmR7aaWbwA5RHkq9sN4FZBFv7w67Fzw+uYN3OGqGxGCfi769GkXsOQpuWubz UnVu6gJjhIoVh7La5/rJcsFkJeCzjV4= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=devkernel.io header.s=fm2 header.b=Dbgqfbas; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=yaDGWL2z; dmarc=none; spf=pass (imf13.hostedemail.com: domain of shr@devkernel.io designates 66.111.4.27 as permitted sender) smtp.mailfrom=shr@devkernel.io ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701461272; a=rsa-sha256; cv=none; b=7hcmAYUFcjdAVXLyJQ3XtwGlSow4d2Mbt2ZBF1PbpslanpeotrsP+r02XmBCflZqCUIWST hZVWg9yC/R7il/7V38HwDgeNXWxFxmJzme/vDaFoJewwt7/kiCzw9NoyScfPYb/LVd2RnR LKos5TkdY6sVNIbt2KmdunGj+BQO81k= Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 4DCE85C0067; Fri, 1 Dec 2023 15:07:51 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 01 Dec 2023 15:07:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devkernel.io; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1701461271; x=1701547671; bh=9XhUjlfuIkMoL0ZK2dbxU2EbPZYrR3D6b5V 4nJScxA0=; b=DbgqfbasQCH4jGJilFGg4FnNZCcKGNexB9nay9zWq+xbyA0Th0I R6hGJSXlK1RCKSTvwP62S1yZdY608P0fZUNRXuQAuATiddmwsIdYQNaMGZ9cg4Sm 5hEQ0fEuPBYAe4W1MzIX+9MmTSBO+1d0RHxXCYW4KKQUkLx2Q1WKeU/3gBkzwvfx Z8O4nyf4GtjB6sfcSt9vR1Ab/vBBYYmwRQYlIoLHoXH0tRRUnV443J9giqW1GEc+ sxupo6CMQ8xcG3G1dUtXakh+L3Lc6vzGt80bWcJr/SQOYgxF5lSLTj+/yUJfFUVu lGpmFGJS+e+2h4LtO5I6I65X1H2AiWqikLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1701461271; x=1701547671; bh=9XhUjlfuIkMoL0ZK2dbxU2EbPZYrR3D6b5V 4nJScxA0=; b=yaDGWL2zVejOsKhQSQcyXUU9DEk+Sw4MWBPTxgqMHPsa8oyg88Z 7pz/CE+QwCwS9B8WumDbbEMjkhdM2Z5S/RMrztbGy4EwMO3X5poK0KAUWXsyhiMB qREzYTjlHHsIg6XQLPZIN7F62UCXyEHYUhpbuGzF6b6Y4i/UG7P0g8mo9LeIJX1S gSghPA3qJWXpgPcIeoIeKeLoF1nIkjulPC2U4jhMx9lqke2dJcgFbIaw48ySXuqO 2+4D9UMuy969MFIJNYKaSL08UtBgOeS6ItJ5XAr8XWnBrMsa/MpH6UyqlG8kc5+0 szZg1M8EwiIwu5zgn3BDLphEOO/2ci+8jPA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeiledgudeffecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpehffgfhvfevufffjgfkgggtgfesthhqredttderjeenucfhrhhomhepufht vghfrghnucftohgvshgthhcuoehshhhrseguvghvkhgvrhhnvghlrdhioheqnecuggftrf grthhtvghrnhepfedtjefhheeileevhfehheeutdekleduueejteffvddtfedtfffhleek geekgfdunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghdpghhithhhuhgsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhhrhes uggvvhhkvghrnhgvlhdrihho X-ME-Proxy: Feedback-ID: i84614614:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 1 Dec 2023 15:07:49 -0500 (EST) References: <20231127174517.2369593-1-shr@devkernel.io> <20231128074626.GA298624@pevik> User-agent: mu4e 1.10.3; emacs 29.1 From: Stefan Roesch To: Li Wang Cc: Petr Vorel , 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 Date: Fri, 01 Dec 2023 12:06:38 -0800 In-reply-to: Message-ID: <874jh1660d.fsf@devkernel.io> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 12C872002B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: orq6a9jr1pn8k6ktkd5ex5p8preb9ixs X-HE-Tag: 1701461271-251620 X-HE-Meta: U2FsdGVkX1/nS1Ln8F2h51ushO9QMV2G6pLSbCyKC+cGOSqSX8nZcEOd3OhNXRi0KmXgtcnyQTmggoii+DcsKdSryxXNxRi49hRBKsniYlRiz8AuBTtcg7IOUY0hSmkggfU/sYLV+iQsmjUkGgvpPrb68sQbzOXDp7FEIAkkqMeNjxZJuNc1oXy9U0fDPaiPf167Xx7oSe2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V6tv+jXC0TcOItKUOkj+xnXdvTetP8u+hDSDnfO6Spy3tQXJ7sdrjW7zq0TfRbRXBR 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: Li Wang writes: > Hi Stefan, Petr, > > On Tue, Nov 28, 2023 at 3:46=E2=80=AFPM Petr Vorel wrote: > > Hi Stefan, > > > This disables the "smart scan" KSM feature to make sure that the volat= ile > > 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.sa= ng@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 uni= t) > > {'a', size*MB}, {'a', size*MB}, {'d', size*MB}, {'d', siz= e*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' fo= r 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 =E2=80=93 Continue without saving the file if it do= es not exist > TST_SR_TBROK_RO =E2=80=93 End test with TBROK if the file is read-only > TST_SR_SKIP_RO =E2=80=93 Continue without saving the file if it is read= -only > TST_SR_SKIP =E2=80=93 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--re= storing-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 sma= rt_scan > will impact all the tests with invoke key function create_same_memory(). > > > > also nit: there is a wrong indent (spaces instead of tabs), please be co= nsistent > 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 thes= e 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 fal= se > positive to be fixed, or whether the problem has already been fixed in n= ewer > 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. > > > > > + > > ps =3D sysconf(_SC_PAGE_SIZE); > > pages =3D MB / ps; > > > @@ -526,6 +529,7 @@ void create_same_memory(int size, int num, int uni= t) > > > 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 p= atch. > > 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 w= orks? > 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? > In the next version of the patch I'll add a new test case specifically to test smart scan.