Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3775097ybb; Mon, 23 Mar 2020 07:30:16 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtD0Ia9x+eTrUAieiW5uWjctHyzIQzilVNBD7oFTYjaUG3gQGWhv9oH8pWqS3+puMHpoPqX X-Received: by 2002:aca:1913:: with SMTP id l19mr6861323oii.12.1584973816723; Mon, 23 Mar 2020 07:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584973816; cv=none; d=google.com; s=arc-20160816; b=SEglb4MCqfa6F4n3FkKm5IHX99A2AW+J5L/QWfm7xlVKZDGkvwqmAljjttllRCqQb8 RzB1tcGnsiM4idH74XhCBd+KC4vBWp2mwkA5kFlcG4OYuPFm9gpKswt/6tfig60Ps3Lb WzNSHAP5da1Z4xvLbZRjfVu9AlLTIjZIIYq6AmdBoBVs/MpawHHHx5gRTAVz+HK0sd8Y zKcZOHwML5Exr87vVpMrDBXEqcsb/80IdZWC3Vjx/gse37Rqb3MW0J8x1Bi23dtZA5uK XzV5bFFvl2FL9Gx10t9Rvft4dZ1djlxl3Ab84Hy5OCGzRXrfiU7yl7mMxdeRMuVJf+DJ Q/ew== 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=PgGrbAJ9j98exfSo98nJNMVRX6RscOjYHAK4YDkqU6w=; b=Y7ZBIOZDw8KsP5n7CFacDs1xWEco52lFwNBqOE5/PIqU3gpEnXMGGPlcAt27FOobV1 c3Y2dirzqkTS2NSKVyYgCb+OO7axqfXVR1+Rygbaiy1C/+FUiUaE5piaETB46aEKAAcI BzUb41IN34np/4KS59Y45ZRv0FU5Qr2hAQ603NOAY6uEsmYm1ElJFZ2ajXdy/NT3UBiX UKB9gjHyvaM7DKpyX3dGo0ooXgqOZwx8Bt0JhWX1NGnnJyPinlsenmNCxOvL9zULSx7J rhIv5WWAxcRGYMP8b4f6/rrvHy/W2TDGjXCPJjxmeg+vmyU8wzNFEjMkyjzFIcgyKPnA KpAQ== 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 r21si4160621otp.320.2020.03.23.07.30.02; Mon, 23 Mar 2020 07:30:16 -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 S1726764AbgCWO3p (ORCPT + 99 others); Mon, 23 Mar 2020 10:29:45 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39361 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725830AbgCWO3p (ORCPT ); Mon, 23 Mar 2020 10:29:45 -0400 Received: by mail-wm1-f65.google.com with SMTP id a9so11989326wmj.4; Mon, 23 Mar 2020 07:29:43 -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=PgGrbAJ9j98exfSo98nJNMVRX6RscOjYHAK4YDkqU6w=; b=UwDcH+L2EuL558+CYxzr3YdodBQrK7RwZYhK4o5BYMuBCh40UA9vLaebQSscaa1weW deLRMuzzmTqyMvEmHhvFqrWaKXetpT2y/nmPctnd+c6WaADbQc936d/EiRVTLJYp+49V jDHqI7FBldPgJrLATnyVa7XD9jYxFpOglnn7eYJ5cQmJH/rdS53Jwb6w+9mSTcMJv7yi tzc7zChTaHio0BSpA/anT6+CsaenSoucpBe2D0NfarZ6DhcuN8+/IhErVfxoTuf1lwSC Z7ey86JId0C6tM4T3Bo4VU+IxPAlAWF8fs/ORHdQkCnvjpvJbZR0h0B6+uZDwSCYOogL uwiA== X-Gm-Message-State: ANhLgQ2xofHj+FE67i7ET4M+6cqY0CbjeVo22AJonX8pnZgHl2djuS5u M0mO00Rk+wjyI0wH5TM1TPM= X-Received: by 2002:a1c:de82:: with SMTP id v124mr27142143wmg.70.1584973783317; Mon, 23 Mar 2020 07:29:43 -0700 (PDT) Received: from localhost (ip-37-188-135-150.eurotel.cz. [37.188.135.150]) by smtp.gmail.com with ESMTPSA id n2sm25447536wro.25.2020.03.23.07.29.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2020 07:29:42 -0700 (PDT) Date: Mon, 23 Mar 2020 15:29:41 +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: <20200323142941.GK7524@dhcp22.suse.cz> References: <20200322013525.1095493-1-aquini@redhat.com> <20200323141659.GA23364@optiplex-lnx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200323141659.GA23364@optiplex-lnx> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 -- Michal Hocko SUSE Labs