Re: mlockall(MCL_CURRENT) blocking infinitely

From: Michal Hocko
Date: Fri Oct 25 2019 - 07:50:42 EST


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
--
Michal Hocko
SUSE Labs