Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3798786ybb; Mon, 23 Mar 2020 07:56:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtC0px7UZgm373a43ZYtIXveOPCTmSVOSJEe/egWIGtzbHd0sBu37GVUQ+lXQsecVMzWoY7 X-Received: by 2002:a54:4001:: with SMTP id x1mr17898591oie.67.1584975387640; Mon, 23 Mar 2020 07:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584975387; cv=none; d=google.com; s=arc-20160816; b=u1T9JEvoHx1Uyx/lTFfe7q1MrhKQNbRWUR7ceYnn0bGVZforLivLllHnVPWbNOOvwh 6Pjv4h5GgQhusYA4Q9UmV5eEmueJdBHQ1fh+HmtFtyJ8dbW0jcEPgdBnpu1b7M/A92gn WGbqtFnwvX9Z0QgpTXw9jSATZGKGcidybFggIdgoPWoKG46utkXG0bd8Ou9ryIsWbr9f IJIqEty1Cq9eWLkNTSq3qBHReJrma5IDYZTcyStn70EvauKbsdKnPNBZ4OjZZ4tfZpBQ cYljK7QmhP15HQSDhp5OjKC2xFaaw/l6NxaA+l/Z1dW6kSOvlmHDQSa69KBYQ1QX6jSg z87A== 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 :dkim-signature; bh=VvGlC8Czl63YZgi4jgzehNhHSqhqg15Zh+SkPrQjW4Y=; b=orqjWFukqyq93D6NaeYM2RtP27o3gTP+FJvzwbn7vzRmrul2fYiDsGBbxH0MJjamOX hLqP00vVoI3S6+Bho7pq+58ViKrxsF9BRxzDaalu47HNg6qtU3Su9hyPw8QrnWc5oQPH wz8C4+sMHRTV5SkTL/2cJGF2H7/LFXaVAUla0UVp/vS2s1QtYiUpTh0eMVINYKwmE4ct u0HF85ssyxKRNG+2M/gCDmnxXOHoZkEXWoHMTKKYaoB4r2YA7dE+98zR/cILfD+HfRA1 E3JBA1tzsoB3g6gKmiq7GrItHTOKcKiyJdWCmuP9waYrRmI6PBfCiPMnTfVRdAxOj8+K UMrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="UH0//XA+"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r21si4193597otp.320.2020.03.23.07.56.15; Mon, 23 Mar 2020 07:56:27 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="UH0//XA+"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727137AbgCWOzw (ORCPT + 99 others); Mon, 23 Mar 2020 10:55:52 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:20091 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725990AbgCWOzw (ORCPT ); Mon, 23 Mar 2020 10:55:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584975350; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VvGlC8Czl63YZgi4jgzehNhHSqhqg15Zh+SkPrQjW4Y=; b=UH0//XA+w6S855aDvVZ3AckN3VkyZOzIg1aom9otoibYvWWFF011uLvM73lzOHv2Kcwz6h vmAOTwpRdNaDCsmNYpdYnA/elifOM74ROcfKnUFlaU57V6zO4AAeq2UgBbUsWLSHMh1tTg PuEAFPrP2LrH3QfszBK10LJevWVkw0Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-316-K7jnb4PuMQqRo8yGC7qZCg-1; Mon, 23 Mar 2020 10:55:48 -0400 X-MC-Unique: K7jnb4PuMQqRo8yGC7qZCg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 473131005514; Mon, 23 Mar 2020 14:55:47 +0000 (UTC) Received: from optiplex-lnx (unknown [10.33.36.220]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63A865F904; Mon, 23 Mar 2020 14:55:45 +0000 (UTC) Date: Mon, 23 Mar 2020 10:55:42 -0400 From: Rafael Aquini To: Michal Hocko 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: <20200323145542.GC23364@optiplex-lnx> 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> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 23, 2020 at 03:29:41PM +0100, 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 > 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 > Again, I don't think the test is bogus, although it's (now) expecting something that is not guaranteed after the referred commit. The check for PG_unevictable set on the page backing up the mapping seems reasonable, as the flag is supposed to be there, if everything went on fine after the mlock call. -- Rafael