balloon.c
static long long pc_lose(page_collection_t *pc, long long bytes) {
    assert(bytes > 0);
    long long i;
    for (i = 0; i < bytes; i += getpagesize()) {
        if (pc->head == NULL) {
            /* We have no pages to drop. */
            break;
        } else {
            void *next = *((void**)pc->head);
            if (unlock_page(pc->head) != 0) {
                /* We failed to unpin a page. Who knows why. */
                break;
            }
            pc->head = next;
            if (pc->head == NULL) {
                /* We just unpinned the last page. */
                pc->last = NULL;
            }
        }
    }
    pc->occupancy -= i;
    return i;
}
/* Decrease the amount of pinned memory by 'bytes' if possible. Returns the
 * actual number of bytes it was decreased by.
 */
Decrease the amount of pinned memory by 'bytes' if possible. Returns the
actual number of bytes it was decreased by.
Decrease the amount of pinned memory by ' bytes ' if possible . Returns the actual number of bytes it was decreased by .
static long long pc_lose(page_collection_t *pc, long long bytes) {
    assert(bytes > 0);
    long long i;
    for (i = 0; i < bytes; i += getpagesize()) {
        if (pc->head == NULL) {
            break;
        } else {
            void *next = *((void**)pc->head);
            if (unlock_page(pc->head) != 0) {
                break;
            }
            pc->head = next;
            if (pc->head == NULL) {
                pc->last = NULL;
            }
        }
    }
    pc->occupancy -= i;
    return i;
}
static long long pc_lose ( page_collection_t * pc , long long bytes ) { assert ( bytes > 0 ) ; long long i ; for ( i = 0 ; i < bytes ; i += getpagesize ( ) ) { if ( pc -> head == NULL ) { break ; } else { void * next = * ( ( void * * ) pc -> head ) ; if ( unlock_page ( pc -> head ) != 0 ) { break ; } pc -> head = next ; if ( pc -> head == NULL ) { pc -> last = NULL ; } } } pc -> occupancy -= i ; return i ; }
Decrease the amount of pinned memory by 'bytes' if possible.
Decrease the amount of pinned memory by ' bytes ' if possible .
/* We have no pages to drop. */ /* We failed to unpin a page. Who knows why. */ /* We just unpinned the last page. */