Lines Matching defs:stack

41 /* Spare thread stack. */
42 struct stack {
43 LIST_ENTRY(stack) qe; /* Stack queue linkage. */
50 * Default sized (stack and guard) spare stack queue. Stacks are cached
51 * to avoid additional complexity managing mmap()ed stack regions. Spare
54 static LIST_HEAD(, stack) dstackq = LIST_HEAD_INITIALIZER(dstackq);
57 * Miscellaneous sized (non-default stack and/or guard) spare stack queue.
59 * stack regions. This list is unordered, since ordering on both stack
63 static LIST_HEAD(, stack) mstackq = LIST_HEAD_INITIALIZER(mstackq);
66 * Base address of the last stack allocated (including its red zone, if
68 * top of the main stack. When a new stack is created, a red zone is
70 * the top of the stack, such that the stack will not be able to grow all
71 * the way to the bottom of the next stack. This isn't fool-proof. It is
72 * possible for a stack to grow by a large amount, such that it grows into
73 * the next stack, and as long as the memory within the red zone is never
74 * accessed, nothing will prevent one thread stack from trouncing all over
80 * | stack 3 | start of 3rd thread stack
86 * | stack 2 - _thr_stack_default | top of 2nd thread stack
91 * | stack 2 |
92 * +-----------------------------------+ <-- start of 2nd thread stack
97 * | stack 1 - _thr_stack_default | top of 1st thread stack
102 * | stack 1 |
103 * +-----------------------------------+ <-- start of 1st thread stack
108 * | USRSTACK - _thr_stack_initial | top of main thread stack
112 * | | | stack growth
114 * +-----------------------------------+ <-- start of main thread stack
168 struct stack *st;
193 struct stack *spare_stack;
199 * Round up stack size to nearest multiple of _thr_page_size so
200 * that mmap() * will work. If the stack size is not an even
202 * unused space above the beginning of the stack, so the stack
213 * spare stack lists and allocations from usrstack.
217 * If the stack and guard sizes are default, try to allocate a stack
218 * from the default-size stack cache:
223 /* Use the spare stack. */
229 * The user specified a non-default stack and/or guard size, so try to
230 * allocate a stack from the non-default size stack cache, using the
231 * rounded up stack size (stack_size) in the search:
244 /* A cached stack was found. Release the lock. */
249 * Allocate a stack from or below usrstack, depending
256 /* Allocate a new stack. */
260 * Even if stack allocation fails, we don't want to try to
263 * likely reason for an mmap() error is a stack overflow of
264 * the adjacent thread stack.
271 /* Map the stack and guard page together, and split guard
296 struct stack *spare_stack;
300 spare_stack = (struct stack *)
302 attr->stacksize_attr - sizeof(struct stack));
309 /* Default stack/guard size. */
312 /* Non-default stack/guard size. */