Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3808463ybb; Mon, 23 Mar 2020 08:05:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsAejFfBDaPkzord8cXiAUhmP/XjuRH8brI+9sxts3M7wia+K9jSYpe34nsrRUkDrMlUUOG X-Received: by 2002:aca:d40f:: with SMTP id l15mr16672430oig.90.1584975923260; Mon, 23 Mar 2020 08:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584975923; cv=none; d=google.com; s=arc-20160816; b=PJRsq+dAGfANa1e546gKeeqPwZSOJUMHtUKmAkJecudFeYVhU+koQSu0nynGBIO2t7 95902UKGiZzpOi2TlR+ONLXVpBdIhOueIee9lAjrQrDnf8/G2uPfYgzl/L/VXKuv5He3 lTwE75dqNuGdAZUILs0zoY8kyZQxd4g1+4PCdeJgHNfP03Hc/KyhVoUYpzRXjcA/fvBm VD+3hBxw+gWUkLlCu/1lz3VsJPO7RC2eGSbo0zbIBYTwkbw3Vv3j5F2KELJ6CjIrwsPU S/f68YoQoM7EIROeWUVea46arNjgusGJ10zIPXGPwbr7c8anWwHAX0r5slz+qHE6lfvA /y8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=BWEC9ZUJwJUU11ZALKTe1h8BQNjpF356QgpNgKWIUoE=; b=YNwDpgSd/62b4VAaTuDyhLcnUJrTIIC9AwM97qRAxV40HV0sUxJGDrXIeDlRh8DP4J dM7BvCCVMKM2sInakVi4rUkcn3xRgTzgUAKDc6GZhM0MpR7wszET3ynBwQLM83HBkih9 aoqQktgyNZc6DqrhnOIAO429vZAnBiaQze38L47XH9c44x2CIpDi4OSv0mq5yOZeRvDz NHgZkJ6EFIZK1JJ3TK0kyEu1v+CUwfWF1QWPaYyonwxmagO3CLvL5YOWNsuIvBqTcaxL vjBWoW6uT0LC4YJYC6tyBumaFLsDgA21T0cBOOqxxvexynJzP2E6oVmP23cXoqxNO+ar KuqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f82si6080028oia.58.2020.03.23.08.04.39; Mon, 23 Mar 2020 08:05:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727229AbgCWPBj (ORCPT + 99 others); Mon, 23 Mar 2020 11:01:39 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40292 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbgCWPBj (ORCPT ); Mon, 23 Mar 2020 11:01:39 -0400 Received: by mail-wm1-f66.google.com with SMTP id a81so9430133wmf.5; Mon, 23 Mar 2020 08:01:37 -0700 (PDT) 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:references :mime-version:content-disposition:in-reply-to; bh=BWEC9ZUJwJUU11ZALKTe1h8BQNjpF356QgpNgKWIUoE=; b=AOJwFAB1resLDZutvmi/+Ua1YOuM3V8Hhym7YQwdnrtmA3HsjJ/D/3vxdQt2lzVuef Zkt6toc903FIYLdJnqGeyWl0+KC6V7X8DSxRQvjcZvbfapr4u2eBamcOP0+/Wzsh1FkZ volmrNfS7NvrqsvvkPw884hir8sZfv0j2o1wXs+G7q/h9eQELhKu++IuTgg2sIgXZado jLeM6XlEMKyGUPa0Wy9762LEEy9I12RQu3/kgF0ecx7KYOVy+NQmJCXIuW0ndGbITJYl fgsPXIY2pIdgLatRRnUuEx7/T3fo+ay2sT8r9s80AgqPJtN4X22j+fFAmloaRZYlMcS9 RPOQ== X-Gm-Message-State: ANhLgQ1K77hUwP31fePsHuXE+oO2AEBwW76BQeONQzAhCQLFSxO7TFCM tzSVPY82erpijnplXul3b24= X-Received: by 2002:a05:600c:d4:: with SMTP id u20mr12421355wmm.83.1584975697314; Mon, 23 Mar 2020 08:01:37 -0700 (PDT) Received: from localhost (ip-37-188-135-150.eurotel.cz. [37.188.135.150]) by smtp.gmail.com with ESMTPSA id k204sm8490964wma.17.2020.03.23.08.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 08:01:36 -0700 (PDT) Date: Mon, 23 Mar 2020 16:01:34 +0100 From: Michal Hocko To: Rafael Aquini Cc: Shakeel Butt , LKML , linux-kselftest@vger.kernel.org, shuah@kernel.org, Andrew Morton Subject: Re: [PATCH] tools/testing/selftests/vm/mlock2-tests: fix mlock2 false-negative errors Message-ID: <20200323150134.GN7524@dhcp22.suse.cz> References: <20200322013525.1095493-1-aquini@redhat.com> <20200323141659.GA23364@optiplex-lnx> <20200323142941.GK7524@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200323142941.GK7524@dhcp22.suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 23-03-20 15:29:43, Michal Hocko wrote: > On Mon 23-03-20 10:16:59, Rafael Aquini wrote: > > On Sun, Mar 22, 2020 at 09:31:04AM -0700, Shakeel Butt wrote: > > > On Sat, Mar 21, 2020 at 6:35 PM Rafael Aquini wrote: > > > > > > > > Changes for commit 9c4e6b1a7027f ("mm, mlock, vmscan: no more skipping pagevecs") > > > > break this test expectations on the behavior of mlock syscall family immediately > > > > inserting the recently faulted pages into the UNEVICTABLE_LRU, when MCL_ONFAULT is > > > > passed to the syscall as part of its flag-set. > > > > > > mlock* syscalls do not provide any guarantee that the pages will be in > > > unevictable LRU, only that the pages will not be paged-out. The test > > > is checking something very internal to the kernel and this is expected > > > to break. > > > > It was a check expected to be satisfied before the commit, though. > > Getting the mlocked pages inserted directly into the unevictable LRU, > > skipping the pagevec, was established behavior before the aforementioned > > commit, and even though one could argue userspace should not be aware, > > or care, about such inner kernel circles the program in question is not an > > ordinary userspace app, but a kernel selftest that is supposed to check > > for the functionality correctness. > > But mlock (in neither mode) is reall forced to put pages to the ble I meant to say "is not really forced" > UNEVICTABLE_LRU for correctness. If the test is really depending on it > then the selftest is bogus. A real MCL_ONFAULT test should focus on the > user observable contract of this api. And that is that a new mapping > doesn't fault in the page during the mlock call but the memory is locked > after the memory is faulted in. You can use different methods to observe > locked memory - e.g. try to reclaim it and check or check /proc//smaps I have just checked the testcase and I believe it is really dubious to check for page flags. Those are really an internal implementation detail. All the available information is available in the /proc//smaps file which is already parsed in the test so the test is easily fixable. -- Michal Hocko SUSE Labs