* [PATCH] powerpc: fix alignment problem in rh_alloc_align() with exact-sized blocks
@ 2007-05-14 16:31 Timur Tabi
2007-05-15 18:21 ` Kumar Gala
0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2007-05-14 16:31 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Timur Tabi
When an rheap is created, the caller can specify the alignment to use. In
rh_alloc_align(), if a free block is found that is the exact size needed
(including extra space for alignment), that configured alignment value is not
used to align the pointer. Instead, the default alignment is used. If the
default alignment is smaller than the configured alignment, then the returned
value will not be aligned correctly.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
arch/powerpc/lib/rheap.c | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
index b2f6dcc..180ee29 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/arch/powerpc/lib/rheap.c
@@ -468,25 +468,19 @@ unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const ch
if (blk->size == size) {
/* Move from free list to taken list */
list_del(&blk->list);
- blk->owner = owner;
- start = blk->start;
-
- attach_taken_block(info, blk);
+ newblk = blk;
+ } else {
+ newblk = get_slot(info);
+ newblk->start = blk->start;
+ newblk->size = size;
- return start;
+ /* blk still in free list, with updated start, size */
+ blk->start += size;
+ blk->size -= size;
}
- newblk = get_slot(info);
- newblk->start = blk->start;
- newblk->size = size;
newblk->owner = owner;
-
- /* blk still in free list, with updated start, size */
- blk->start += size;
- blk->size -= size;
-
start = newblk->start;
-
attach_taken_block(info, newblk);
/* for larger alignment return fixed up pointer */
--
1.5.0.2.260.g2eb065
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc: fix alignment problem in rh_alloc_align() with exact-sized blocks
2007-05-14 16:31 [PATCH] powerpc: fix alignment problem in rh_alloc_align() with exact-sized blocks Timur Tabi
@ 2007-05-15 18:21 ` Kumar Gala
0 siblings, 0 replies; 2+ messages in thread
From: Kumar Gala @ 2007-05-15 18:21 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
On Mon, 14 May 2007, Timur Tabi wrote:
> When an rheap is created, the caller can specify the alignment to use. In
> rh_alloc_align(), if a free block is found that is the exact size needed
> (including extra space for alignment), that configured alignment value is not
> used to align the pointer. Instead, the default alignment is used. If the
> default alignment is smaller than the configured alignment, then the returned
> value will not be aligned correctly.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> arch/powerpc/lib/rheap.c | 22 ++++++++--------------
> 1 files changed, 8 insertions(+), 14 deletions(-)
>
applied.
- k
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-05-15 18:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-14 16:31 [PATCH] powerpc: fix alignment problem in rh_alloc_align() with exact-sized blocks Timur Tabi
2007-05-15 18:21 ` Kumar Gala
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).