| 154 | } |
| 155 | |
| 156 | static void add_level(struct timers *timers, unsigned int level) |
| 157 | { |
| 158 | struct timer_level *l; |
| 159 | struct timer *t; |
| 160 | unsigned int i; |
| 161 | struct list_head from_far; |
| 162 | |
| 163 | l = timer_alloc(timers, sizeof(*l)); |
| 164 | if (!l) |
| 165 | return; |
| 166 | |
| 167 | for (i = 0; i < ARRAY_SIZE(l->list); i++) |
| 168 | list_head_init(&l->list[i]); |
| 169 | timers->level[level] = l; |
| 170 | |
| 171 | list_head_init(&from_far); |
| 172 | timers_far_get(timers, &from_far, |
| 173 | timers->base + (1ULL << ((level+1)*TIMER_LEVEL_BITS)) - 1); |
| 174 | |
| 175 | while ((t = list_pop(&from_far, struct timer, list)) != NULL) |
| 176 | timer_add_raw(timers, t); |
| 177 | } |
| 178 | |
| 179 | /* We don't need to search past the first at level 0, since the |
| 180 | * bucket range is 1; they're all the same. */ |