Rev 764 | Rev 786 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 764 | Rev 768 | ||
---|---|---|---|
Line 113... | Line 113... | ||
113 | { |
113 | { |
114 | ipl_t ipl; |
114 | ipl_t ipl; |
115 | link_t *tmp; |
115 | link_t *tmp; |
116 | zone_t *zone = NULL; |
116 | zone_t *zone = NULL; |
117 | frame_t *frame = NULL; |
117 | frame_t *frame = NULL; |
- | 118 | int freed; |
|
118 | __address v; |
119 | __address v; |
119 | 120 | ||
120 | loop: |
121 | loop: |
121 | ipl = interrupts_disable(); |
122 | ipl = interrupts_disable(); |
122 | spinlock_lock(&zone_head_lock); |
123 | spinlock_lock(&zone_head_lock); |
Line 133... | Line 134... | ||
133 | } |
134 | } |
134 | if (!zone) { |
135 | if (!zone) { |
135 | zone = find_free_zone(order); |
136 | zone = find_free_zone(order); |
136 | /* If no memory, reclaim some slab memory, |
137 | /* If no memory, reclaim some slab memory, |
137 | if it does not help, reclaim all */ |
138 | if it does not help, reclaim all */ |
138 | if (!zone && !(flags & FRAME_NO_RECLAIM)) |
139 | if (!zone && !(flags & FRAME_NO_RECLAIM)) { |
- | 140 | spinlock_unlock(&zone_head_lock); |
|
139 | if (slab_reclaim(0) || slab_reclaim(SLAB_RECLAIM_ALL)) |
141 | freed = slab_reclaim(0); |
- | 142 | spinlock_lock(&zone_head_lock); |
|
- | 143 | if (freed) |
|
140 | zone = find_free_zone(order); |
144 | zone = find_free_zone(order); |
- | 145 | if (!zone) { |
|
- | 146 | spinlock_unlock(&zone_head_lock); |
|
- | 147 | freed = slab_reclaim(SLAB_RECLAIM_ALL); |
|
- | 148 | spinlock_lock(&zone_head_lock); |
|
- | 149 | if (freed) |
|
- | 150 | zone = find_free_zone(order); |
|
- | 151 | } |
|
- | 152 | } |
|
141 | } |
153 | } |
142 | 154 | ||
143 | if (!zone) { |
155 | if (!zone) { |
144 | if (flags & FRAME_PANIC) |
156 | if (flags & FRAME_PANIC) |
145 | panic("Can't allocate frame.\n"); |
157 | panic("Can't allocate frame.\n"); |