lkml.org 
[lkml]   [2006]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [patch] avoid unaligned access when accessing poll stack
    From
    Date
    Andi Kleen <ak@suse.de> writes:

    > On Friday 31 March 2006 18:37, OGAWA Hirofumi wrote:
    >> Jes Sorensen <jes@sgi.com> writes:
    >>
    >> > struct poll_list *walk;
    >> > struct fdtable *fdt;
    >> > int max_fdset;
    >> > - /* Allocate small arguments on the stack to save memory and be faster */
    >> > - char stack_pps[POLL_STACK_ALLOC];
    >> > + /* Allocate small arguments on the stack to save memory and be
    >> > + faster - use long to make sure the buffer is aligned properly
    >> > + on 64 bit archs to avoid unaligned access */
    >> > + long stack_pps[POLL_STACK_ALLOC/sizeof(long)];
    >> > struct poll_list *stack_pp = NULL;
    >>
    >> struct poll_list stack_pps[POLL_STACK_ALLOC / sizeof(struct poll_list)];
    >>
    >> is more readable, and probably gcc align it rightly?
    >
    > Yes, but it would be wrong

    OK. So how about this?

    char stack_pps[POLL_STACK_ALLOC]
    __attribute__((aligned (sizeof(struct poll_list))));
    --
    OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-03-31 19:19    [W:0.046 / U:0.088 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site