51
53
} ____cacheline_aligned_in_smp;
57
* Number of tags we move between the percpu freelist and the global freelist at
60
#define IDA_DEFAULT_PCPU_BATCH_MOVE 32U
61
/* Max size of percpu freelist, */
62
#define IDA_DEFAULT_PCPU_SIZE ((IDA_DEFAULT_PCPU_BATCH_MOVE * 3) / 2)
54
64
int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp);
55
65
void percpu_ida_free(struct percpu_ida *pool, unsigned tag);
57
67
void percpu_ida_destroy(struct percpu_ida *pool);
58
int percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags);
68
int __percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags,
69
unsigned long max_size, unsigned long batch_size);
70
static inline int percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags)
72
return __percpu_ida_init(pool, nr_tags, IDA_DEFAULT_PCPU_SIZE,
73
IDA_DEFAULT_PCPU_BATCH_MOVE);
76
typedef int (*percpu_ida_cb)(unsigned, void *);
77
int percpu_ida_for_each_free(struct percpu_ida *pool, percpu_ida_cb fn,
80
unsigned percpu_ida_free_tags(struct percpu_ida *pool, int cpu);
60
81
#endif /* __PERCPU_IDA_H__ */