Re: [patch] avoid unaligned access when accessing poll stack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jes Sorensen <jes@xxxxxxx> 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?
-- 
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
-
: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Sparc Linux]     [DCCP]     [Linux ARM]     [Yosemite News]     [Linux SCSI]     [Linux x86_64]     [Linux for Ham Radio]

  Powered by Linux