On Mon, May 13, 2019 at 11:56:31AM +0100, Will Deacon wrote: > Hi Sudeep, > > On Thu, May 09, 2019 at 03:13:50PM +0100, Sudeep Holla wrote: > > On Thu, May 09, 2019 at 11:35:59AM +0100, Sudeep Holla wrote: > > > On Thu, May 09, 2019 at 10:28:11AM +0100, Will Deacon wrote: > > > > [...] > > > > > > > > > > Since SPE uses virtual addressing, we don't really care about the underlying > > > > page layout so there's no need to use higher-order allocations. I suppose we > > > > could theoretically map them at the pmd level in some cases, but ignoring > > > > them should also be harmless and I suspect you can delete the check. > > > > > > > > > > Yes, I did a quick look to see if we can do that, but couldn't find a clue. > > > Not sure if that's any optimisation, we can use order from page_private > > > and set the values accordingly ? > > > > > And I forgot to add the diff that I mentioned above, something like the > > patch below. > > > > Regards, > > Sudeep > > > > -->8 > > > > diff --git i/drivers/perf/arm_spe_pmu.c w/drivers/perf/arm_spe_pmu.c > > index 7cb766dafe85..45cd62517080 100644 > > --- i/drivers/perf/arm_spe_pmu.c > > +++ w/drivers/perf/arm_spe_pmu.c > > @@ -827,7 +827,7 @@ static void arm_spe_pmu_read(struct perf_event *event) > > static void *arm_spe_pmu_setup_aux(struct perf_event *event, void **pages, > > int nr_pages, bool snapshot) > > { > > - int i, cpu = event->cpu; > > + int i, j, cpu = event->cpu; > > struct page **pglist; > > struct arm_spe_pmu_buf *buf; > > > > @@ -859,11 +859,12 @@ static void *arm_spe_pmu_setup_aux(struct perf_event *event, void **pages, > > struct page *page = virt_to_page(pages[i]); > > > > if (PagePrivate(page)) { > > - pr_warn("unexpected high-order page for auxbuf!"); > > - goto out_free_pglist; > > + for (j = 0; j < 1 << page_private(page); j++) > > + pglist[i + j] = page++; > > + i += j - 1; > > + } else { > > + pglist[i] = page; > > Hmm. Given that vmap() doesn't do anything special for high-order pages > and rb_alloc_aux()/rb_alloc_aux_page() already split the allocation up > for the page array, what does your change accomplish on top of that? > Not much, instead of computing page ptr for each page using virt_to_page, we jump pointers automatically for all the pages that are private. page_private(page) holds the order. i.e. for 2MB high order allocation we can skip calling virt_to_page for 511 pages that are contiguous. -- Regards, Sudeep