Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2865560ybb; Sun, 22 Mar 2020 09:31:46 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvq+X2d7DuMB0w/bMk19xOZFM4Z9zfFp4SqyTuTFDCGMrpu4cpTD2cF289lKDSjI3VMS+z7 X-Received: by 2002:a05:6830:3109:: with SMTP id b9mr15582817ots.369.1584894706071; Sun, 22 Mar 2020 09:31:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584894706; cv=none; d=google.com; s=arc-20160816; b=Hb4DcD6wNAATrp4aCub5+9RAKJ7OGtiKcrZMm8evVL3pdO3CjpypjIuL6LQPLcjtzU LhksYf3oZNg2U0m//pKG1R7Pc/DFGm6uSQZRo3h5T3TUaNk71fndZ70yLrWTJyyUO4X/ kwhDbvUj5Asm7s3HVyiMs8DvfFdPmyd9huHsnlMrga0tjQBg+NqHoC+Ty5r2+XhT19vM giHj1tzGgRaIJhb+dLEgDDKxfig81bSI0spJg2eFGWJ8X/dUZS/x6olPmDBlsJbyE1PW D/SiY/12U3BetxL3p+CFV9woeV/kP4CwhsXJklbmSwJbyxnONr0+ysW7vQ1us0F4e+Qf zFsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=4iL/vxcmuCGdmEbGF65JPTkLwm3vbSnxis9k9yz7zYU=; b=EXc9wm4XjncxQXxwKUy/ZLt+Bncqb57K/u11h/tAvWpCVEmd8SCPM3dhEf7E/rcMAN exBGUakBB0eJ6BBUczoHGrVVVD/UwZqY2K9agm4buSyaLDS0pI+6CEqdgAONGRsIk7P5 1GPrZEbJdiuKPp6iyoQmm1/sIDltngwFFgMICoNvIrRKyj0H5EZYPmk9ZgEZC5/NIPzH cz9ah2pNTC28/UHbW7lAyhwm5isTmlV4jTXIyZB3PMFOTYd0NGk5hqmgDJU6ikOkpLpm RQrESQnMeBs371lswxt831wPbGmZaXcdJ0f/jeeNCnStJry+V//WK+pDQbEO96+XB2zc 0RrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CFIDTDub; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x66si6020517ota.244.2020.03.22.09.31.33; Sun, 22 Mar 2020 09:31:46 -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=@google.com header.s=20161025 header.b=CFIDTDub; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726809AbgCVQbQ (ORCPT + 99 others); Sun, 22 Mar 2020 12:31:16 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:38905 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbgCVQbQ (ORCPT ); Sun, 22 Mar 2020 12:31:16 -0400 Received: by mail-oi1-f195.google.com with SMTP id w2so1210967oic.5 for ; Sun, 22 Mar 2020 09:31:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4iL/vxcmuCGdmEbGF65JPTkLwm3vbSnxis9k9yz7zYU=; b=CFIDTDuboOmS5h57Eudf0IOM+t8BzaWRSenk2qqS+UCiQSEQDcK68Ay6EsBL7FiqJe cRl715GSB3yvnyV3i7HqgOBcSIwatwYdyiCTcrSl2C+rsODPDabazvC5JL3l1e671qS8 6MfpFENsIXCidvU9Vg9++kwJWzgjmArPMkjPE0KBnaYGCDbCFBfh1RNcv63cG7m/c5gg lBoDc75R1GAE8xmT4mBSdXZ8FN0ZWlEGz2iPuwsBZ8V6Nuo+ocqDsCSAlIONXFZFFtPy jm09NEk2e+679EIXBmgrgAHwxPLuFyMUkEOgeWPnDRdeGB8Cgf/mXV69Tq2JltuO/L/7 8pDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4iL/vxcmuCGdmEbGF65JPTkLwm3vbSnxis9k9yz7zYU=; b=r4KrpryL0fsb3GsntMm88EG/4na03HXknYVqFCSEXiB9P/Ec9DHVeVt4uDo+yW5S6+ PQ9DZsTDM3VVNCdPzSikvtqvQ5r7AWg9qJCFMnZgyC0qDc3BV87C1huCROpYcfFx9nnM OPsjR7HHL1F6FRKF7Z0KISdkN6rGR+uj2CA42YtHXtBzx5cacc3bVbMtcUBMOvRxJt4c bvxGTRsn2v/QLQ+hLCWT75cmwdN9ZQqfqPgNItM6ljKebNVX2K6JxWInxeheiGC+ASMe lUUlk5sCRzOvbjnp+5T7352CKDOFHk7+50J/M6GRxgjLMBcMk/BQpWDNwb9t7pDUxbiq Imlg== X-Gm-Message-State: ANhLgQ0oiugjl0QKxCbm7KGrjp+KvOZg9wi/efEYXILyiMAl0OwW+rEU tf4m6pLOcwx4imylgmbXTai7RspP9nq+b9e1UZBQ2Q== X-Received: by 2002:aca:ed54:: with SMTP id l81mr14515219oih.69.1584894675252; Sun, 22 Mar 2020 09:31:15 -0700 (PDT) MIME-Version: 1.0 References: <20200322013525.1095493-1-aquini@redhat.com> In-Reply-To: <20200322013525.1095493-1-aquini@redhat.com> From: Shakeel Butt Date: Sun, 22 Mar 2020 09:31:04 -0700 Message-ID: Subject: Re: [PATCH] tools/testing/selftests/vm/mlock2-tests: fix mlock2 false-negative errors To: Rafael Aquini Cc: LKML , linux-kselftest@vger.kernel.org, shuah@kernel.org, Andrew Morton Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > There is no functional error introduced by the aforementioned commit, > but it opens up a time window where the recently faulted and locked pages > might yet not be put back into the UNEVICTABLE_LRU, thus causing a > subsequent and immediate PFN flag check for the UNEVICTABLE bit > to trip on false-negative errors, as it happens with this test. > > This patch fix the false negative by forcefully resorting to a code path that > will call a CPU pagevec drain right after the fault but before the PFN flag > check takes place, sorting out the race that way. > > Fixes: 9c4e6b1a7027f ("mm, mlock, vmscan: no more skipping pagevecs") This is fixing the actual test and not about fixing the mentioned patch. So, this Fixes line is not needed.