Lines Matching defs:stack
42 /* Spare thread stack. */
43 struct stack {
44 LIST_ENTRY(stack) qe; /* Stack queue linkage. */
51 * Default sized (stack and guard) spare stack queue. Stacks are cached
52 * to avoid additional complexity managing mmap()ed stack regions. Spare
55 static LIST_HEAD(, stack) dstackq = LIST_HEAD_INITIALIZER(dstackq);
58 * Miscellaneous sized (non-default stack and/or guard) spare stack queue.
60 * stack regions. This list is unordered, since ordering on both stack
64 static LIST_HEAD(, stack) mstackq = LIST_HEAD_INITIALIZER(mstackq);
67 * Base address of the last stack allocated (including its red zone, if
69 * top of the main stack. When a new stack is created, a red zone is
71 * the top of the stack, such that the stack will not be able to grow all
72 * the way to the bottom of the next stack. This isn't fool-proof. It is
73 * possible for a stack to grow by a large amount, such that it grows into
74 * the next stack, and as long as the memory within the red zone is never
75 * accessed, nothing will prevent one thread stack from trouncing all over
81 * | stack 3 | start of 3rd thread stack
87 * | stack 2 - _thr_stack_default | top of 2nd thread stack
92 * | stack 2 |
93 * +-----------------------------------+ <-- start of 2nd thread stack
98 * | stack 1 - _thr_stack_default | top of 1st thread stack
103 * | stack 1 |
104 * +-----------------------------------+ <-- start of 1st thread stack
109 * | USRSTACK - _thr_stack_initial | top of main thread stack
113 * | | | stack growth
115 * +-----------------------------------+ <-- start of main thread stack
158 struct stack *st;
183 struct stack *spare_stack;
189 * Round up stack size to nearest multiple of _thr_page_size so
190 * that mmap() * will work. If the stack size is not an even
192 * unused space above the beginning of the stack, so the stack
203 * spare stack lists and allocations from usrstack.
207 * If the stack and guard sizes are default, try to allocate a stack
208 * from the default-size stack cache:
213 /* Use the spare stack. */
219 * The user specified a non-default stack and/or guard size, so try to
220 * allocate a stack from the non-default size stack cache, using the
221 * rounded up stack size (stack_size) in the search:
234 /* A cached stack was found. Release the lock. */
239 * Allocate a stack from or below usrstack, depending
246 /* Allocate a new stack. */
250 * Even if stack allocation fails, we don't want to try to
253 * likely reason for an mmap() error is a stack overflow of
254 * the adjacent thread stack.
261 /* Map the stack and guard page together, and split guard
286 struct stack *spare_stack;
290 spare_stack = (struct stack *)
292 attr->stacksize_attr - sizeof(struct stack));
299 /* Default stack/guard size. */
302 /* Non-default stack/guard size. */