netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: shamir.rabinovitch@oracle.com
Cc: rds-devel@oss.oracle.com, netdev@vger.kernel.org
Subject: Re: [PATCH v3 1/2] RDS: fix "Kernel unaligned access" on sparc64
Date: Mon, 04 Apr 2016 15:57:46 -0400 (EDT)	[thread overview]
Message-ID: <20160404.155746.167310851507943497.davem@davemloft.net> (raw)
In-Reply-To: <1459686244-14939-1-git-send-email-shamir.rabinovitch@oracle.com>

From: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
Date: Sun,  3 Apr 2016 08:24:03 -0400

> @@ -135,8 +135,9 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes,
>  			if (rem->r_offset != 0)
>  				rds_stats_inc(s_page_remainder_hit);
>  
> -			rem->r_offset += bytes;
> -			if (rem->r_offset == PAGE_SIZE) {
> +			/* fix 'Kernel unaligned access' on sparc64 */
> +			rem->r_offset += ALIGN(bytes, 8);
> +			if (rem->r_offset >= PAGE_SIZE) {

It is inappropriate to mark things with a comment like this in code
that has nothing at all to do what a specific architecture.

64-bit alignment, and this requirement, is also not sparc64 specific.
Other architectures have the same issue.

Next, comments should aide in the understanding of what the code is
trying to accomplish, when necessary.  So, something more appropriate
would be:

	/* Objects in this memory can countain 64-bit integers, align
	 * in order to accomodate that.
	 */

But it's very close to obvious here what the code is doing, and why
it might be doing so.

So I'd so no comment at all works best here.

I'm sorry, but it's a real pet peeve of mine when people mention
totally irrelevant crap in code comments.  What the heck does sparc64
have to do with aligning memory properly for the data types you will
be storing in that memory?!?!

      parent reply	other threads:[~2016-04-04 19:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-03 12:24 [PATCH v3 1/2] RDS: fix "Kernel unaligned access" on sparc64 Shamir Rabinovitch
2016-04-03 12:24 ` [PATCH v3 2/2] RDS: fix congestion map corruption for PAGE_SIZE > 8k Shamir Rabinovitch
2016-04-04 19:57 ` David Miller [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=20160404.155746.167310851507943497.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=rds-devel@oss.oracle.com \
    --cc=shamir.rabinovitch@oracle.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).