*
  * Return:     0 on success or error code.
  */
-static int topa_insert_pages(struct pt_buffer *buf, gfp_t gfp)
+static int topa_insert_pages(struct pt_buffer *buf, int cpu, gfp_t gfp)
 {
        struct topa *topa = buf->last;
        int order = 0;
                order = page_private(p);
 
        if (topa_table_full(topa)) {
-               topa = topa_alloc(buf->cpu, gfp);
+               topa = topa_alloc(cpu, gfp);
                if (!topa)
                        return -ENOMEM;
 
  * @size:      Total size of all regions within this ToPA.
  * @gfp:       Allocation flags.
  */
-static int pt_buffer_init_topa(struct pt_buffer *buf, unsigned long nr_pages,
-                              gfp_t gfp)
+static int pt_buffer_init_topa(struct pt_buffer *buf, int cpu,
+                              unsigned long nr_pages, gfp_t gfp)
 {
        struct topa *topa;
        int err;
 
-       topa = topa_alloc(buf->cpu, gfp);
+       topa = topa_alloc(cpu, gfp);
        if (!topa)
                return -ENOMEM;
 
        topa_insert_table(buf, topa);
 
        while (buf->nr_pages < nr_pages) {
-               err = topa_insert_pages(buf, gfp);
+               err = topa_insert_pages(buf, cpu, gfp);
                if (err) {
                        pt_buffer_fini_topa(buf);
                        return -ENOMEM;
        if (!buf)
                return NULL;
 
-       buf->cpu = cpu;
        buf->snapshot = snapshot;
        buf->data_pages = pages;
 
        INIT_LIST_HEAD(&buf->tables);
 
-       ret = pt_buffer_init_topa(buf, nr_pages, GFP_KERNEL);
+       ret = pt_buffer_init_topa(buf, cpu, nr_pages, GFP_KERNEL);
        if (ret) {
                kfree(buf);
                return NULL;
 
 /**
  * struct pt_buffer - buffer configuration; one buffer per task_struct or
  *             cpu, depending on perf event configuration
- * @cpu:       cpu for per-cpu allocation
  * @tables:    list of ToPA tables in this buffer
  * @first:     shorthand for first topa table
  * @last:      shorthand for last topa table
  * @topa_index:        table of topa entries indexed by page offset
  */
 struct pt_buffer {
-       int                     cpu;
        struct list_head        tables;
        struct topa             *first, *last, *cur;
        unsigned int            cur_idx;