public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@tilera•com>
To: Pete Zaitcev <zaitcev@redhat•com>
Cc: Evgeniy Polyakov <zbr@ioremap•net>, Erik Jacobson <erikj@sgi•com>,
	Andrew Morton <akpm@osdl•org>, Matt Helsley <matthltc@us•ibm.com>,
	<netdev@vger•kernel.org>, <linux-kernel@vger•kernel.org>
Subject: Re: [PATCH] connector: improved unaligned access error fix
Date: Thu, 14 Nov 2013 16:22:32 -0500	[thread overview]
Message-ID: <52853F18.4040605@tilera.com> (raw)
In-Reply-To: <20131114124549.7b5f3a7b@lembas.zaitcev.lan>

On 11/14/2013 2:45 PM, Pete Zaitcev wrote:
> On Thu, 14 Nov 2013 12:09:21 -0500
> Chris Metcalf <cmetcalf@tilera•com> wrote:
>
>> -	__u8 buffer[CN_PROC_MSG_SIZE];
>> +	__u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
>> -	msg = (struct cn_msg *)buffer;
>> +	msg = buffer_to_cn_msg(buffer);
>>  	ev = (struct proc_event *)msg->data;
>>  	memset(&ev->event_data, 0, sizeof(ev->event_data));
> Why is memset(buffer,0,CN_PROC_MSG_SIZE) not acceptable?

That would be fine from a correctness point of view; I'm happy
either way.  My patch nominally has better performance, for
what that's worth, since the memset() call is for a smaller
range (24 bytes instead of 60).  It also avoids the need for
put_unaligned(), which even on platforms that allow unaligned
stores can still be slower.

I can certainly do a v2 with the larger memset() instead if
that's the consensus.

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com

  reply	other threads:[~2013-11-14 21:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 17:09 [PATCH] connector: improved unaligned access error fix Chris Metcalf
2013-11-14 19:45 ` Pete Zaitcev
2013-11-14 21:22   ` Chris Metcalf [this message]
2013-11-14 22:20 ` David Miller

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=52853F18.4040605@tilera.com \
    --to=cmetcalf@tilera$(echo .)com \
    --cc=akpm@osdl$(echo .)org \
    --cc=erikj@sgi$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=matthltc@us$(echo .)ibm.com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=zaitcev@redhat$(echo .)com \
    --cc=zbr@ioremap$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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