rcu_read_unlock();
}
-static unsigned long perf_data_size(struct perf_mmap_data *data)
-{
- return data->nr_pages << (PAGE_SHIFT + data->data_order);
-}
-
#ifndef CONFIG_PERF_USE_VMALLOC
/*
goto fail_data_pages;
}
- data->data_order = 0;
data->nr_pages = nr_pages;
return data;
kfree(data);
}
+static inline int page_order(struct perf_mmap_data *data)
+{
+ return 0;
+}
+
#else
/*
* Required for architectures that have d-cache aliasing issues.
*/
+static inline int page_order(struct perf_mmap_data *data)
+{
+ return data->page_order;
+}
+
static struct page *
perf_mmap_to_page(struct perf_mmap_data *data, unsigned long pgoff)
{
- if (pgoff > (1UL << data->data_order))
+ if (pgoff > (1UL << page_order(data)))
return NULL;
return vmalloc_to_page((void *)data->user_page + pgoff * PAGE_SIZE);
int i, nr;
data = container_of(work, struct perf_mmap_data, work);
- nr = 1 << data->data_order;
+ nr = 1 << page_order(data);
base = data->user_page;
for (i = 0; i < nr + 1; i++)
data->user_page = all_buf;
data->data_pages[0] = all_buf + PAGE_SIZE;
- data->data_order = ilog2(nr_pages);
+ data->page_order = ilog2(nr_pages);
data->nr_pages = 1;
return data;
#endif
+static unsigned long perf_data_size(struct perf_mmap_data *data)
+{
+ return data->nr_pages << (PAGE_SHIFT + page_order(data));
+}
+
static int perf_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
struct perf_event *event = vma->vm_file->private_data;
handle->addr += size;
handle->size -= size;
if (!handle->size) {
+ struct perf_mmap_data *data = handle->data;
+
handle->page++;
- handle->page &= handle->data->nr_pages - 1;
- handle->addr = handle->data->data_pages[handle->page];
- handle->size = PAGE_SIZE << handle->data->data_order;
+ handle->page &= data->nr_pages - 1;
+ handle->addr = data->data_pages[handle->page];
+ handle->size = PAGE_SIZE << page_order(data);
}
} while (len);
}
if (head - local_read(&data->wakeup) > data->watermark)
local_add(data->watermark, &data->wakeup);
- handle->page = handle->offset >> (PAGE_SHIFT + data->data_order);
+ handle->page = handle->offset >> (PAGE_SHIFT + page_order(data));
handle->page &= data->nr_pages - 1;
- handle->size = handle->offset & ((PAGE_SIZE << data->data_order) - 1);
+ handle->size = handle->offset & ((PAGE_SIZE << page_order(data)) - 1);
handle->addr = data->data_pages[handle->page];
handle->addr += handle->size;
- handle->size = (PAGE_SIZE << data->data_order) - handle->size;
+ handle->size = (PAGE_SIZE << page_order(data)) - handle->size;
if (have_lost) {
lost_event.header.type = PERF_RECORD_LOST;