All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shan Wei <shanwei88@gmail.com>
To: Christoph Lameter <cl@linux.com>
Cc: rostedt@goodmis.org, fweisbec@gmail.com,
	Kernel-Maillist <linux-kernel@vger.kernel.org>,
	mingo@redhat.com
Subject: Re: [PATCH v3 7/9] trace: use this_cpu_ptr per-cpu helper
Date: Mon, 12 Nov 2012 10:05:09 +0800	[thread overview]
Message-ID: <50A05955.6040509@gmail.com> (raw)
In-Reply-To: <0000013ae6cfb10f-87b4a0ea-98fe-4269-a834-9ebb64fe61fa-000000@email.amazonses.com>

Christoph Lameter said, at 2012/11/10 4:15:
> On Fri, 9 Nov 2012, Shan Wei wrote:
> 
>> -	return buffer->buffer;
>> +	return (char *)this_cpu_ptr(&percpu_buffer->buffer);
>>  }
> 
> Add a comment to explain the cast?

typeof(&buffer) is a pointer to array of 1024 char, or char (*)[1024].
But, typeof(&buffer[0]) is a pointer to char which match the return type of get_trace_buf().
As well-known, the value of &buffer is equal to &buffer[0].
so return this_cpu_ptr(&percpu_buffer->buffer[0]) can avoid this cast. 

I will submit v4 version patch which improve it.

Thanks~

      reply	other threads:[~2012-11-12  2:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-09  2:21 [PATCH v3 7/9] trace: use this_cpu_ptr per-cpu helper Shan Wei
2012-11-09 20:15 ` Christoph Lameter
2012-11-12  2:05   ` Shan Wei [this message]

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=50A05955.6040509@gmail.com \
    --to=shanwei88@gmail.com \
    --cc=cl@linux.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.