434,9 → 434,13 |
/** Allocate frame in particular zone |
* |
* Assume zone is locked |
* Panics, if allocation is impossible. |
* Panics if allocation is impossible. |
* |
* @param zone Zone to allocate from. |
* @param order Allocate exactly 2^order frames. |
* |
* @return Frame index in zone |
* |
*/ |
static pfn_t zone_frame_alloc(zone_t *zone,__u8 order) |
{ |
891,11 → 895,13 |
|
/** Allocate power-of-two frames of physical memory. |
* |
* @param order Allocate exactly 2^order frames. |
* @param flags Flags for host zone selection and address processing. |
* @param order Allocate exactly 2^order frames. |
* @param status Allocation status (FRAME_OK on success), unused if NULL. |
* @param pzone Preferred zone |
* |
* @return Allocated frame. |
* |
*/ |
pfn_t frame_alloc_generic(__u8 order, int flags, int * status, int *pzone) |
{ |
906,10 → 912,12 |
|
loop: |
ipl = interrupts_disable(); |
|
/* |
* First, find suitable frame zone. |
*/ |
zone = find_free_zone_lock(order,pzone); |
|
/* If no memory, reclaim some slab memory, |
if it does not help, reclaim all */ |
if (!zone && !(flags & FRAME_NO_RECLAIM)) { |
941,6 → 949,7 |
panic("Sleep not implemented.\n"); |
goto loop; |
} |
|
v = zone_frame_alloc(zone,order); |
v += zone->base; |
|