Re: mlockall(MCL_CURRENT) blocking infinitely

From: Michal Hocko
Date: Fri Oct 25 2019 - 10:01:54 EST


On Fri 25-10-19 15:45:37, Robert Stupp wrote:
> On Fri, 2019-10-25 at 15:27 +0200, Michal Hocko wrote:
> > On Fri 25-10-19 15:10:39, Robert Stupp wrote:
> > [...]
> > > cat /proc/$(pidof test)/smaps
> >
> > Nothing really unusual that would jump at me except for
> > > 7f8be90ed000-7f8be9265000 r-xp 00025000 103:02
> > > 44307431 /lib/x86_64-linux-gnu/libc-2.30.so
> > > Size: 1504 kB
> > > KernelPageSize: 4 kB
> > > MMUPageSize: 4 kB
> > > Rss: 832 kB
> > > Pss: 5 kB
> > > Shared_Clean: 832 kB
> > > Shared_Dirty: 0 kB
> > > Private_Clean: 0 kB
> > > Private_Dirty: 0 kB
> > > Referenced: 832 kB
> > > Anonymous: 0 kB
> > > LazyFree: 0 kB
> > > AnonHugePages: 0 kB
> > > ShmemPmdMapped: 0 kB
> > > Shared_Hugetlb: 0 kB
> > > Private_Hugetlb: 0 kB
> > > Swap: 0 kB
> > > SwapPss: 0 kB
> > > Locked: 5 kB
> >
> > Huh, 5kB, is this really the case or some copy&paste error?
> > How can we end up with !pagesize multiple here?

Ohh, I haven't noticed pss and didn't realize that Locked is pss like as
well.

> >
> > > THPeligible: 0
> > > VmFlags: rd ex mr mw me lo sd
>
> mlockall() seems to lock everything though, it just never returns.
>
> Pretty sure that it's not a copy&paste error. Got a couple more runs
> that have an "odd size" - this time with 3kB...
> All "Locked" values seem to be okay - except that one. And it's always
> odd for the same one (the one with `Size: 1504 kB`).
> It's not always odd (3 kB or 5 kB) though - sometimes it says 4 kB.
> Seems it's a little breadcrumb?

Please try to watch for stack of the syscall and see if there is any
pattern.
--
Michal Hocko
SUSE Labs