[Development] QProcess fork() failure and overcommit

Thiago Macieira thiago.macieira at intel.com
Wed Mar 8 14:32:58 CET 2017


Em quarta-feira, 8 de março de 2017, às 13:51:49 CET, Christian Kandeler 
escreveu:
> I use the default settings for overcommit (0/heuristic). My application
> starts QProcesses in a loop. If the application has not allocated
> additional memory, strace -T for clone() gives:
> 
> <0.000079>
> <0.000091>
> <0.000205>
> <0.000090>
> <0.000119>
> <0.000112>
> <0.000231>
> <0.000096>
> <0.000114>
> <0.000112>
> 
> Here's the same application using 1GB of additional memory:
> 
> <0.012753>
> <0.016715>
> <0.015152>
> <0.014449>
> <0.012960>
> <0.016914>
> <0.013560>
> <0.013337>
> <0.012911>
> <0.013019>
> 
> So, factors around 100?

Not unexpected, if you use 100x more memory. clone() has a fixed cost for 
creating the necessary book-keeping and it may have some non-O(1) dependent on 
the number of running processes running, but it's definitely O(n) on the memory 
-- the Linux kernel does not apply the book-keeping on the 2MB page table 
directory level, only on the actual 4 kB page table entries.

That said, look at the numbers: it increased from ~100 µs to 16.9 ms in the 
worst case. You can't perceive that difference.

> (Also, I get lots of ERESTARTNOINTR in the latter case).

Ignore that, it's not visible.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list