~ubuntu-branches/debian/experimental/linux-tools/experimental

« back to all changes in this revision

Viewing changes to include/linux/percpu_ida.h

  • Committer: Package Import Robot
  • Author(s): Ben Hutchings
  • Date: 2014-02-02 16:57:49 UTC
  • mfrom: (1.1.10) (0.1.21 sid)
  • Revision ID: package-import@ubuntu.com-20140202165749-tw94o9t1t0a8txk6
Tags: 3.13-1~exp2
Merge changes from sid up to 3.12.6-3

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
         * percpu_ida_init()
17
17
         */
18
18
        unsigned                        nr_tags;
 
19
        unsigned                        percpu_max_size;
 
20
        unsigned                        percpu_batch_size;
19
21
 
20
22
        struct percpu_ida_cpu __percpu  *tag_cpu;
21
23
 
51
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
64
int percpu_ida_alloc(struct percpu_ida *pool, gfp_t gfp);
55
65
void percpu_ida_free(struct percpu_ida *pool, unsigned tag);
56
66
 
57
67
void percpu_ida_destroy(struct percpu_ida *pool);
58
 
int percpu_ida_init(struct percpu_ida *pool, unsigned long nr_tags);
59
 
 
 
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);
 
79
 
 
80
unsigned percpu_ida_free_tags(struct percpu_ida *pool, int cpu);
60
81
#endif /* __PERCPU_IDA_H__ */