slab.c
inline void
__slab_remove(kmem_cache_t cp, kmem_slab_t slab) {
    slab->next->prev = slab->prev;
    slab->prev->next = slab->next;

    // if front slab...
    if (cp->slabs == slab) {
        // if last slab
        if (slab->prev == slab) 
            cp->slabs = NULL;
        else
            cp->slabs = slab->prev;
    }

    // if back slab
    if (cp->slabs_back == slab) { 
        // if last slab
        if (slab->next == slab) 
            cp->slabs_back = NULL;
        else
            cp->slabs_back = slab->next;
    }
}
/* Internal auxiliary to remove slab of freelist

    @cp cache pointer
    @slab slab pointer
*/
Internal auxiliary to remove slab of freelist
Internal auxiliary to remove slab of freelist
inline void
__slab_remove(kmem_cache_t cp, kmem_slab_t slab) {
    slab->next->prev = slab->prev;
    slab->prev->next = slab->next;
    if (cp->slabs == slab) {
        if (slab->prev == slab) 
            cp->slabs = NULL;
        else
            cp->slabs = slab->prev;
    }
    if (cp->slabs_back == slab) { 
        if (slab->next == slab) 
            cp->slabs_back = NULL;
        else
            cp->slabs_back = slab->next;
    }
}
inline void __slab_remove ( kmem_cache_t cp , kmem_slab_t slab ) { slab -> next -> prev = slab -> prev ; slab -> prev -> next = slab -> next ; if ( cp -> slabs == slab ) { if ( slab -> prev == slab ) cp -> slabs = NULL ; else cp -> slabs = slab -> prev ; } if ( cp -> slabs_back == slab ) { if ( slab -> next == slab ) cp -> slabs_back = NULL ; else cp -> slabs_back = slab -> next ; } }
Internal auxiliary to remove slab of freelist
Internal auxiliary to remove slab of freelist
// if front slab... // if last slab // if back slab // if last slab