Re: [PATCH 1/2] perf/x86/intel/bts: Remove a silly warning
From: Peter Zijlstra
Date: Tue Dec 10 2019 - 10:29:45 EST
On Thu, Dec 05, 2019 at 05:28:52PM +0300, Alexander Shishkin wrote:
> There is no comment or record anywhere that would explain the train of
> thought that went into this warning, it probably tried to make sure that
> the high order allocations indeed happened in the ring buffer code.
>
> --- a/arch/x86/events/intel/bts.c
> +++ b/arch/x86/events/intel/bts.c
> @@ -83,8 +83,6 @@ bts_buffer_setup_aux(struct perf_event *event, void **pages,
> /* count all the high order buffers */
> for (pg = 0, nbuf = 0; pg < nr_pages;) {
> page = virt_to_page(pages[pg]);
> - if (WARN_ON_ONCE(!PagePrivate(page) && nr_pages > 1))
> - return NULL;
> pg += 1 << page_private(page);
I'm thinking that because ^^^^ uses page_private(), it wants to make
sure PagePrivate().
I haven't checked the current rules, but using page_private() without
PagePrivate() seems dodgy.
Also consider:
+ __nr_pages = PagePrivate(page) ? 1 << page_private(page) : 1;
> nbuf++;
> }
> --
> 2.24.0
>