diff options
| author | Mark Brown <broonie@linaro.org> | 2013-11-24 09:35:18 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2013-11-24 09:35:18 -0500 |
| commit | 30c27abd28fa168d7ebd2e5286f1fe473c74bfa9 (patch) | |
| tree | 9936b38c0c81cd430d5e75906c1207d127fe588c /include/linux/percpu_ida.h | |
| parent | 16ec790938d4f356c82fab27b9a9adf4d6fe19a6 (diff) | |
| parent | 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff) | |
Merge tag 'v3.13-rc1' into asoc-arizona
Linux 3.13-rc1
Diffstat (limited to 'include/linux/percpu_ida.h')
| -rw-r--r-- | include/linux/percpu_ida.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/linux/percpu_ida.h b/include/linux/percpu_ida.h index 0b23edbee309..1900bd0fa639 100644 --- a/include/linux/percpu_ida.h +++ b/include/linux/percpu_ida.h | |||
| @@ -16,6 +16,8 @@ struct percpu_ida { | |||
| 16 | * percpu_ida_init() | 16 | * percpu_ida_init() |
| 17 | */ | 17 | */ |
| 18 | unsigned nr_tags; | 18 | unsigned nr_tags; |
| 19 | unsigned percpu_max_size; | ||
| 20 | unsigned percpu_batch_size; | ||
| 19 | 21 | ||
| 20 | struct percpu_ida_cpu __percpu *tag_cpu; | 22 | struct percpu_ida_cpu __percpu *tag_cpu; |
| 21 | 23 | ||
| @@ -51,10 +53,29 @@ struct percpu_ida { | |||
| 51 | } ____cacheline_aligned_in_smp; | 53 | } ____cacheline_aligned_in_smp; |
| 52 | }; | 54 | }; |
| 53 | 55 | ||
| 56 | /* | ||
| 57 | * Number of tags we move between the percpu freelist and the global freelist at | ||
| 58 | * a time | ||
| 59 | */ | ||
| 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) | ||
| 63 | |||
| 54 | int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp); | 64 | int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp); |
| 55 | void percpu_ida_free(struct percpu_ida *pool, unsigned tag); | 65 | void percpu_ida_free(struct percpu_ida *pool, unsigned tag); |
| 56 | 66 | ||
| 57 | void percpu_ida_destroy(struct percpu_ida *pool); | 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) | ||
| 71 | { | ||
| 72 | return __percpu_ida_init(pool, nr_tags, IDA_DEFAULT_PCPU_SIZE, | ||
| 73 | IDA_DEFAULT_PCPU_BATCH_MOVE); | ||
| 74 | } | ||
| 75 | |||
| 76 | typedef int (*percpu_ida_cb)(unsigned, void *); | ||
| 77 | int percpu_ida_for_each_free(struct percpu_ida *pool, percpu_ida_cb fn, | ||
| 78 | void *data); | ||
| 59 | 79 | ||
| 80 | unsigned percpu_ida_free_tags(struct percpu_ida *pool, int cpu); | ||
| 60 | #endif /* __PERCPU_IDA_H__ */ | 81 | #endif /* __PERCPU_IDA_H__ */ |
