Lines Matching defs:token
31 struct token {
36 struct token *tokens;
41 token_idx_t token_init_idx = 1; /* token 0 is reserved!! */
43 * be added onto token queue */
45 int available_for_purge = 0; /* increase when ripe token
47 * token removed protect with
56 #define TOKEN_QUEUE_ADVANCE 0x42/* 0x108 actually means "token ripened" */
68 token_idx_t token = queue->token_q_head;
72 while (token) {
73 if (tokens[token].count != 0) {
76 assert(token == queue->token_q_unripe);
77 unripe = token;
79 page_cnt += tokens[token].count;
81 if (tokens[token].next == 0)
82 assert(queue->token_q_tail == token);
85 token = tokens[token].next;
92 /* obsolete queue doesn't maintain token counts */
105 /* new token */
106 token_idx_t token;
112 token = token_free_idx;
114 } else if (token_init_idx < token_q_max_cnt) { /* lazy token array init */
115 token = token_init_idx;
136 struct token *new_loc;
158 struct token *old_tokens=tokens;
162 token_q_max_cnt = token_q_cur_size / sizeof(struct token);
163 assert (token_init_idx < token_q_max_cnt); /* We must have a free token now */
179 assert (token);
193 /* set token counter value */
195 tokens[token].count = queue->new_pages;
197 tokens[token].count = 0; /* all obsolete items are
201 /* put token on token counter list */
202 tokens[token].next = 0;
205 queue->token_q_head = token;
207 tokens[queue->token_q_tail].next = token;
209 if (queue->token_q_unripe == 0) { /* only ripe tokens (token
211 if (tokens[token].count > 0)
212 queue->token_q_unripe = token; /* first unripe token */
214 available_for_purge++; /* added a ripe token?
217 queue->token_q_tail = token;
227 tokens[token].count, /* num pages on token
228 * (last token) */
238 * Remove first token from queue and return its index. Add its count to the
239 * count of the next token.
244 token_idx_t token;
245 token = queue->token_q_head;
247 assert(token);
249 if (token) {
253 queue->token_q_unripe = tokens[token].next;
255 /* we're removing a ripe token. decrease count */
261 assert(tokens[token].next == 0);
263 queue->token_q_head = tokens[token].next;
265 tokens[queue->token_q_head].count += tokens[token].count;
270 * created token
272 queue->new_pages += tokens[token].count;
284 * first token */
286 * next token */
291 return token;
294 /* Delete first token from queue. Return token to token queue. */
298 token_idx_t token = vm_purgeable_token_remove_first(queue);
300 if (token) {
301 /* stick removed token on free queue */
302 tokens[token].next = token_free_idx;
303 token_free_idx = token;
326 * Decrement token counters. A token counter can be zero, this means the
354 * first token */
358 continue; /* One token ripened. Make sure to
362 break; /* Current token not ripe and no more pages.
384 * each volatile group. Select a queue with a ripe token.
387 * Yes - purge it. Remove token.
390 * Yes - purge it. Remove token. If there is no ripe token, remove ripe
391 * token from other queue and migrate unripe token from this
398 /* return token to free list. advance token list. */
416 * Delete a ripe token from the given queue. If there are no ripe tokens on
417 * that queue, delete a ripe token from queue2, and migrate an unripe token
426 /* This queue has a ripe token. Remove. */
431 * queue2 must have a ripe token. Remove, and migrate one
435 /* migrate unripe token */
436 token_idx_t token;
439 /* remove token from queue1 */
442 token = vm_purgeable_token_remove_first(queue);
443 assert(token);
445 count = tokens[token].count;
456 * unripe token */
458 queue2->token_q_unripe = token; /* must update unripe
461 /* insert token */
462 tokens[token].count = count;
463 tokens[token].next = *token_in_queue2;
467 * inserting before token, reduce counter of that token
470 queue2->token_q_tail = token; /* must update tail
478 *token_in_queue2 = token;
535 continue; /* no token? Look at next purgeable
542 * lock, remove a token and then purge the object.
552 /* This is the token migration case, and it works between