fork: fallback to global store of stack pages

If we run out of per-cpu-reserved stack pages, utilize a
bigger, global stash of 8 pages at the cost of taking a lock.

This page pool just take a lock so they will be slightly slower
and will incude latency.

They will only be used under stressful circumstances: in practical
tests I have not yet been able to make this happen, but for the
advent that it would happen once in a blue moon we have this
fallback.

It can be provoked to be the only mechanism for testing, comment
out the lines obtaining per-CPU pages in dynamic_stack_get_page().

The page pool is then refilled in an irq_work in order not to
disturb the scheduling. If this ever happens on a system, it does
not blend well with realtime.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 file changed