All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chris Friesen" <cfriesen@nortel.com>
To: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Chris Snook <csnook@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [Slightly off topic] A question about R/B trees.
Date: Mon, 20 Oct 2008 08:54:44 -0600	[thread overview]
Message-ID: <48FC9BB4.3050603@nortel.com> (raw)
In-Reply-To: <48F91612.5020901@gmail.com>

Maxim Levitsky wrote:

> Say you allocate a piece of memory using kmalloc, and write there, a
> structure that contains a r/b tree item. I agree that gcc will ensure
> that offset from start of that structure to first byte of the tree
> item will be aligned.
> 
> But what if malloc returned a misaligned pointer? This will ensure
> that virtual address of the tree item won't be aligned. (I know it
> doesn't, but this isn't a assumption about gcc anymore)

malloc() can't return a misaligned pointer.  From the spec:  "The 
pointer returned if the allocation succeeds shall be suitably aligned so 
that it may be assigned to a pointer to any type of object..."

Chris

  reply	other threads:[~2008-10-20 14:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-17 21:34 [Slightly off topic] A question about R/B trees Maxim Levitsky
2008-10-17 22:15 ` Chris Snook
2008-10-17 22:47   ` Maxim Levitsky
2008-10-20 14:54     ` Chris Friesen [this message]
2008-10-18  7:53   ` Andi Kleen
2008-10-18  8:45     ` Pekka Enberg
2008-10-20 15:57       ` Maxim Levitsky

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=48FC9BB4.3050603@nortel.com \
    --to=cfriesen@nortel.com \
    --cc=csnook@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maximlevitsky@gmail.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 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.