static struct cds_lfht *alloc_cds_lfht(unsigned long min_nr_alloc_buckets, unsigned long max_nr_buckets) { return __default_alloc_cds_lfht( &cds_lfht_mm_order, sizeof(struct cds_lfht), min_nr_alloc_buckets, max_nr_buckets); }
static struct cds_lfht *alloc_cds_lfht(unsigned long min_nr_alloc_buckets, unsigned long max_nr_buckets) { unsigned long nr_chunks, cds_lfht_size; min_nr_alloc_buckets = max(min_nr_alloc_buckets, max_nr_buckets / MAX_CHUNK_TABLE); nr_chunks = max_nr_buckets / min_nr_alloc_buckets; cds_lfht_size = offsetof(struct cds_lfht, tbl_chunk) + sizeof(struct cds_lfht_node *) * nr_chunks; cds_lfht_size = max(cds_lfht_size, sizeof(struct cds_lfht)); return __default_alloc_cds_lfht( &cds_lfht_mm_chunk, cds_lfht_size, min_nr_alloc_buckets, max_nr_buckets); }
static struct cds_lfht *alloc_cds_lfht(unsigned long min_nr_alloc_buckets, unsigned long max_nr_buckets) { unsigned long page_bucket_size; page_bucket_size = getpagesize() / sizeof(struct cds_lfht_node); if (max_nr_buckets <= page_bucket_size) { /* small table */ min_nr_alloc_buckets = max_nr_buckets; } else { /* large table */ min_nr_alloc_buckets = max(min_nr_alloc_buckets, page_bucket_size); } return __default_alloc_cds_lfht( &cds_lfht_mm_mmap, sizeof(struct cds_lfht), min_nr_alloc_buckets, max_nr_buckets); }