public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: "Hen, Shmulik" <shmulik.hen@intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: kernel memory allocations alignment
Date: 04 Feb 2001 18:00:05 +0100	[thread overview]
Message-ID: <oup66iq8ju2.fsf@pigdrop.muc.suse.de> (raw)
In-Reply-To: <07E6E3B8C072D211AC4100A0C9C5758302B2711B@hasmsx52.iil.intel.com>
In-Reply-To: "Hen, Shmulik"'s message of "4 Feb 2001 17:18:50 +0100"

"Hen, Shmulik" <shmulik.hen@intel.com> writes:

> Actually yes. We were warned that on IA64 architecture the system will halt
> when accessing any type of variable via a pointer if the pointer does not
> contain an aligned address matching that type. Until now we were using a

That will need to be fixed with a handler anyways, the network stack requires 
unaligned accesses. If the IA64 port doesn't handle that it it's buggy and 
trivially remotely crashable.

Of course it'll always be much faster to use aligned accesses that do not
need an exception.

> method of receiving a pointer to an array, casting it to a pointer of a
> struct (packed with #pragma pack(1) ) ,and retrieving fields directly from
> it with pointers.
> It seems we cannot do that any more and were wondering what are the
> alternatives.

get_unaligned() or a memcpy to a local variable is the standard method.
get_unaligned is normally slightly faster than relying on an unalignment
exception handler.

> One way we could think of is forget the packing and rearrange the fields in
> the struct in descending order so they all come out aligned, but we didn't
> know for sure if the first one will be aligned too.
> 
> Will that work ?

Yes, it's the best solution.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  reply	other threads:[~2001-02-04 17:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-04 16:15 kernel memory allocations alignment Hen, Shmulik
2001-02-04 17:00 ` Andi Kleen [this message]
2001-02-04 18:17   ` Johannes Erdfelt
  -- strict thread matches above, loose matches on Subject: below --
2001-02-04 14:19 Hen, Shmulik
2001-02-04 15:56 ` Manfred

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=oup66iq8ju2.fsf@pigdrop.muc.suse.de \
    --to=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shmulik.hen@intel.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