Re: mlockall(MCL_CURRENT) blocking infinitely

From: Robert Stupp
Date: Fri Oct 25 2019 - 08:00:22 EST


On Fri, 2019-10-25 at 13:50 +0200, Michal Hocko wrote:
> On Fri 25-10-19 13:46:33, Michal Hocko wrote:
> > On Fri 25-10-19 13:02:23, Robert Stupp wrote:
> > > On Fri, 2019-10-25 at 11:21 +0200, Michal Hocko wrote:
> > > > On Thu 24-10-19 16:34:46, Randy Dunlap wrote:
> > > > > [adding linux-mm + people]
> > > > >
> > > > > On 10/24/19 12:36 AM, Robert Stupp wrote:
> > > > > > Hi guys,
> > > > > >
> > > > > > I've got an issue with `mlockall(MCL_CURRENT)` after
> > > > > > upgrading
> > > > > > Ubuntu 19.04 to 19.10 - i.e. kernel version change from
> > > > > > 5.0.x to
> > > > > > 5.3.x.
> > > > > >
> > > > > > The following simple program hangs forever with one CPU
> > > > > > running
> > > > > > at 100% (kernel):
> > > >
> > > > Can you capture everal snapshots of proc/$(pidof
> > > > $YOURTASK)/stack
> > > > while
> > > > this is happening?
>
> Btw. I have tested
> $ cat test_mlockall.c
> #include <stdio.h>
> #include <sys/mman.h>
> int main(char** argv) {
> printf("Before mlockall(MCL_CURRENT|MCL_FUTURE)\n");
> // works in 5.0
> // hangs forever w/ 5.1 and newer
> int e = mlockall(MCL_CURRENT|MCL_FUTURE);
> printf("After mlockall(MCL_CURRENT|MCL_FUTURE) %d\n", e);
> }
>
> $./test_mlockall
> Before mlockall(MCL_CURRENT|MCL_FUTURE)
> After mlockall(MCL_CURRENT|MCL_FUTURE) 0

I suspect, that it's something that's "special" on my machine. But I've
got no clue what that might be. Do you think it makes sense to try with
all the spectre/meltdown mitigations disabled? Or SMT disabled?