]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: vm: drop dependencies on page flags from mlock2 tests
authorMichal Hocko <mhocko@suse.com>
Thu, 2 Apr 2020 04:10:25 +0000 (21:10 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Apr 2020 08:50:19 +0000 (10:50 +0200)
commit9c80f8e306747b7696cccfb2cc1c02a3bdb88d19
treecfe797c67bc73e13ba782c4f7b38b6ab5dee322b
parente86fcae2df261f895a5005e9103c8949757b6685
selftests: vm: drop dependencies on page flags from mlock2 tests

commit bf2226ab4dd706385d70c8069a1b11d333995fd2 upstream.

It was noticed that mlock2 tests are failing after 09e86dc6ae493 ("mm,
mlock, vmscan: no more skipping pagevecs") because the patch has changed
the timing on when the page is added to the unevictable LRU list and thus
gains the unevictable page flag.

The test was just too dependent on the implementation details which were
true at the time when it was introduced.  Page flags and the timing when
they are set is something no userspace should ever depend on.  The test
should be testing only for the user observable contract of the tested
syscalls.  Those are defined pretty well for the mlock and there are other
means for testing them.  In fact this is already done and testing for page
flags can be safely dropped to achieve the aimed purpose.  Present bits
can be checked by /proc/<pid>/smaps RSS field and the locking state by
VmFlags although I would argue that Locked: field would be more
appropriate.

Drop all the page flag machinery and considerably simplify the test.  This
should be more robust for future kernel changes while checking the
promised contract is still valid.

Fixes: 09e86dc6ae493 ("mm, mlock, vmscan: no more skipping pagevecs")
Reported-by: Rafael Aquini <aquini@redhat.com>
Signed-off-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Rafael Aquini <aquini@redhat.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Eric B Munson <emunson@akamai.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/20200324154218.GS19542@dhcp22.suse.cz
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/vm/mlock2-tests.c