balloon.c
static long long pc_gain(page_collection_t *pc, long long bytes) {
    assert(bytes > 0);
    long long i;
    for (i = 0; i < bytes; i += getpagesize()) {
        void *p = lock_page();
        if (p == NULL) {
            /* We failed to pin another page. */
            break;
        }
        if (pc->head == NULL) {
            /* There is nothing in the list currently. */
            pc->head = p;
            pc->last = p;
        } else {
            /* Common case append. */
            *((void**)pc->last) = p;
            pc->last = p;
        }
    }
    pc->occupancy += i;
    return i;
}
/* Increase the amount of pinned memory by 'bytes' if possible. Returns the
 * actual number of bytes it was increased by.
 */
Increase the amount of pinned memory by 'bytes' if possible. Returns the
actual number of bytes it was increased by.
Increase the amount of pinned memory by ' bytes ' if possible . Returns the actual number of bytes it was increased by .
static long long pc_gain(page_collection_t *pc, long long bytes) {
    assert(bytes > 0);
    long long i;
    for (i = 0; i < bytes; i += getpagesize()) {
        void *p = lock_page();
        if (p == NULL) {
            break;
        }
        if (pc->head == NULL) {
            pc->head = p;
            pc->last = p;
        } else {
            *((void**)pc->last) = p;
            pc->last = p;
        }
    }
    pc->occupancy += i;
    return i;
}
static long long pc_gain ( page_collection_t * pc , long long bytes ) { assert ( bytes > 0 ) ; long long i ; for ( i = 0 ; i < bytes ; i += getpagesize ( ) ) { void * p = lock_page ( ) ; if ( p == NULL ) { break ; } if ( pc -> head == NULL ) { pc -> head = p ; pc -> last = p ; } else { * ( ( void * * ) pc -> last ) = p ; pc -> last = p ; } } pc -> occupancy += i ; return i ; }
Increase the amount of pinned memory by 'bytes' if possible.
Increase the amount of pinned memory by ' bytes ' if possible .
/* We failed to pin another page. */ /* There is nothing in the list currently. */ /* Common case append. */