linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: linuxppc-dev@ozlabs.org, Jiri Olsa <jolsa@redhat.com>,
	dev@codyps.com, linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [PATCH 1/2] perf/powerpc/hv-24x7: Use per-cpu page buffer
Date: Wed, 10 Dec 2014 20:09:09 +1100	[thread overview]
Message-ID: <1418202549.9279.0.camel@ellerman.id.au> (raw)
In-Reply-To: <20141210070637.GA27377@us.ibm.com>

On Tue, 2014-12-09 at 23:06 -0800, Sukadev Bhattiprolu wrote:
> From 470c16c8955672103a9529c78dffbb239e9e27b8 Mon Sep 17 00:00:00 2001
> From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> Date: Tue, 9 Dec 2014 22:17:46 -0500
> Subject: [PATCH 1/2] perf/poweprc/hv-24x7: Use per-cpu page buffer
> 
> diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
> index dba3408..18e1f49 100644
> --- a/arch/powerpc/perf/hv-24x7.c
> +++ b/arch/powerpc/perf/hv-24x7.c
> @@ -217,11 +217,14 @@ static bool is_physical_domain(int domain)
>  		domain == HV_24X7_PERF_DOMAIN_PHYSICAL_CORE;
>  }
>  
> +DEFINE_PER_CPU(char, hv_24x7_reqb[4096]);
> +DEFINE_PER_CPU(char, hv_24x7_resb[4096]);

Do we need it to be 4K aligned also? I would guess so.

Rather than declaring these as char arrays and then casting below, can you pull
the struct definitions up and then declare the per cpu variables with the
proper type.


>  static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix,
>  					 u16 lpar, u64 *res,
>  					 bool success_expected)
>  {
> -	unsigned long ret = -ENOMEM;
> +	unsigned long ret;
>  
>  	/*
>  	 * request_buffer and result_buffer are not required to be 4k aligned,
> @@ -243,13 +246,11 @@ static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix,
>  	BUILD_BUG_ON(sizeof(*request_buffer) > 4096);
>  	BUILD_BUG_ON(sizeof(*result_buffer) > 4096);
>  
> -	request_buffer = kmem_cache_zalloc(hv_page_cache, GFP_USER);
> -	if (!request_buffer)
> -		goto out;
> +	request_buffer = (void *)get_cpu_var(hv_24x7_reqb);
> +	result_buffer = (void *)get_cpu_var(hv_24x7_resb);
>  
> -	result_buffer = kmem_cache_zalloc(hv_page_cache, GFP_USER);
> -	if (!result_buffer)
> -		goto out_free_request_buffer;
> +	memset(request_buffer, 0, 4096);
> +	memset(result_buffer, 0, 4096);

Do we have to memset them? That's not going to speed things up.


cheers

  parent reply	other threads:[~2014-12-10  9:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10  7:06 [PATCH 1/2] perf/powerpc/hv-24x7: Use per-cpu page buffer Sukadev Bhattiprolu
2014-12-10  7:09 ` [PATCH 2/2] perf/power/hv-24x7: Use kmem_cache_free() instead of kfree Sukadev Bhattiprolu
2014-12-10  9:11   ` Michael Ellerman
2014-12-10  9:09 ` Michael Ellerman [this message]
2014-12-10 22:29   ` [PATCH 1/2] perf/powerpc/hv-24x7: Use per-cpu page buffer Sukadev Bhattiprolu
2014-12-11  1:44     ` [1/2] " Michael Ellerman

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=1418202549.9279.0.camel@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=acme@kernel.org \
    --cc=dev@codyps.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=sukadev@linux.vnet.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).