Re: [PATCH] USB: f_mass_storage: dynamic buffers for betteralignment

From: Felipe Balbi
Date: Mon Mar 15 2010 - 14:10:03 EST


On Mon, Mar 15, 2010 at 11:09:55AM +0100, Michal Nazarewicz wrote:
> "Static" buffers in fsg_buffhd structure (ie. fields which are arrays
> rather then pointers to dynamically allocated memory) are not aligned
> to any "big" power of two which may lead to poor DMA performance

not so true as you can add __attribute__ ((aligned(32))) to those.

> @@ -2747,13 +2746,18 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
>
>
> /* Data buffers cyclic list */
> - /* Buffers in buffhds are static -- no need for additional
> - * allocation. */
> bh = common->buffhds;
> - i = FSG_NUM_BUFFERS - 1;
> - do {
> + i = FSG_NUM_BUFFERS;
> + for (i = FSG_NUM_BUFFERS;; ++bh) {

something like

for (i = 0; i < FSG_NUM_BUFFERS; i++, ++bh) {

wouldn't it do it ??

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