public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Takao Indoh <indou.takao@jp.fujitsu.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf/ring_buffer: Fix invalid page order
Date: Tue, 15 Nov 2016 09:48:14 +0100	[thread overview]
Message-ID: <20161115084814.GB6130@gmail.com> (raw)
In-Reply-To: <20161115071559.3756-1-indou.takao@jp.fujitsu.com>


* Takao Indoh <indou.takao@jp.fujitsu.com> wrote:

> In rb_alloc_aux_page(), a page order is set to MAX_ORDER when order is
> greater than MAX_ORDER, but page order should be less than MAX_ORDER,
> therefore alloc_pages_node fails at least once. This patch fixes page
> order so that it can be always less than MAX_ORDER.
> 
> Signed-off-by: Takao Indoh <indou.takao@jp.fujitsu.com>
> ---
>  kernel/events/ring_buffer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> index 257fa46..3f76fdd 100644
> --- a/kernel/events/ring_buffer.c
> +++ b/kernel/events/ring_buffer.c
> @@ -502,8 +502,8 @@ static struct page *rb_alloc_aux_page(int node, int order)
>  {
>  	struct page *page;
>  
> -	if (order > MAX_ORDER)
> -		order = MAX_ORDER;
> +	if (order >= MAX_ORDER)
> +		order = MAX_ORDER - 1;
>  
>  	do {
>  		page = alloc_pages_node(node, PERF_AUX_GFP, order);

I'm wondering under what circumstances this allocation failure was seen in 
practice - why did others not hit this?

Thanks,

	Ingo

  reply	other threads:[~2016-11-15  8:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-15  7:15 [PATCH] perf/ring_buffer: Fix invalid page order Takao Indoh
2016-11-15  8:48 ` Ingo Molnar [this message]
2016-11-15  9:11   ` Takao Indoh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161115084814.GB6130@gmail.com \
    --to=mingo@kernel.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=indou.takao@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox