/* * cds_lfht_free_bucket_table() should be called with decreasing order. * When cds_lfht_free_bucket_table(0) is called, it means the whole * lfht is destroyed. */ static void cds_lfht_free_bucket_table(struct cds_lfht *ht, unsigned long order) { if (order == 0) poison_free(ht->tbl_order[0]); else if (order > ht->min_alloc_buckets_order) poison_free(ht->tbl_order[order]); /* Nothing to do for 0 < order && order <= ht->min_alloc_buckets_order */ }
/* * cds_lfht_free_bucket_table() should be called with decreasing order. * When cds_lfht_free_bucket_table(0) is called, it means the whole * lfht is destroyed. */ static void cds_lfht_free_bucket_table(struct cds_lfht *ht, unsigned long order) { if (order == 0) poison_free(ht->tbl_chunk[0]); else if (order > ht->min_alloc_buckets_order) { unsigned long i, len = 1UL << (order - 1 - ht->min_alloc_buckets_order); for (i = len; i < 2 * len; i++) poison_free(ht->tbl_chunk[i]); } /* Nothing to do for 0 < order && order <= ht->min_alloc_buckets_order */ }
/* * cds_lfht_free_bucket_table() should be called with decreasing order. * When cds_lfht_free_bucket_table(0) is called, it means the whole * lfht is destroyed. */ static void cds_lfht_free_bucket_table(struct cds_lfht *ht, unsigned long order) { if (order == 0) { if (ht->min_nr_alloc_buckets == ht->max_nr_buckets) { /* small table */ poison_free(ht->tbl_mmap); return; } /* large table */ memory_unmap(ht->tbl_mmap, ht->max_nr_buckets * sizeof(*ht->tbl_mmap)); } else if (order > ht->min_alloc_buckets_order) { /* large table */ unsigned long len = 1UL << (order - 1); assert(ht->min_nr_alloc_buckets < ht->max_nr_buckets); memory_discard(ht->tbl_mmap + len, len * sizeof(*ht->tbl_mmap)); } /* Nothing to do for 0 < order && order <= ht->min_alloc_buckets_order */ }