mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
memlock: allocate at most halve of rlimit stack
Touch of stack allocation validated given size with rlimit and if the reserved_stack was above rlimit, its been completely ignored - now we will always touch stack upto rlimit/2 size.
This commit is contained in:
parent
bd272e3bce
commit
fdec4cd3e6
@ -167,10 +167,13 @@ static void _allocate_memory(void)
|
|||||||
char *areas[max_areas];
|
char *areas[max_areas];
|
||||||
|
|
||||||
/* Check if we could preallocate requested stack */
|
/* Check if we could preallocate requested stack */
|
||||||
if ((getrlimit (RLIMIT_STACK, &limit) == 0) &&
|
if (getrlimit(RLIMIT_STACK, &limit) == 0) {
|
||||||
((_size_stack * 2) < limit.rlim_cur) &&
|
limit.rlim_cur /= 2;
|
||||||
((stack_mem = alloca(_size_stack))))
|
if (_size_stack > limit.rlim_cur)
|
||||||
_touch_memory(stack_mem, _size_stack);
|
_size_stack = limit.rlim_cur;
|
||||||
|
if ((stack_mem = alloca(_size_stack)))
|
||||||
|
_touch_memory(stack_mem, _size_stack);
|
||||||
|
}
|
||||||
/* FIXME else warn user setting got ignored */
|
/* FIXME else warn user setting got ignored */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user