• Michal Hocko's avatar
    selftests: vm: drop dependencies on page flags from mlock2 tests · eea274d6
    Michal Hocko authored
    It was noticed that mlock2 tests are failing after 9c4e6b1a ("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: 9c4e6b1a ("mm, mlock, vmscan: no more skipping pagevecs")
    Reported-by: default avatarRafael Aquini <aquini@redhat.com>
    Signed-off-by: default avatarMichal Hocko <mhocko@suse.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Acked-by: default avatarRafael 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.czSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    eea274d6
mlock2-tests.c 10.1 KB