386,6 → 386,8 |
* Assure that the current magazine is empty, return pointer to it, or NULL if |
* no empty magazine is available and cannot be allocated |
* |
* Assume mag_cache[CPU->id].lock is held |
* |
* We have 2 magazines bound to processor. |
* First try the current. |
* If full, try the last. |
420,8 → 422,11 |
newmag->busy = 0; |
|
/* Flush last to magazine list */ |
if (lastmag) |
if (lastmag) { |
spinlock_lock(&cache->lock); |
list_prepend(&lastmag->link, &cache->magazines); |
spinlock_unlock(&cache->lock); |
} |
/* Move current as last, save new as current */ |
cache->mag_cache[CPU->id].last = cmag; |
cache->mag_cache[CPU->id].current = newmag; |