>+Warnings: Memory coherency operates at a granularity called the cache
>+line width. [...]
That's a description of "inconsistent" memory. "Consistent"
memory does not have the cache line problems. It is uncached.
Architectures that cannot allocate memory with this property cannot
allocate consistent memory, and accomodating what I think motivated
James to take a whack at this.
>The driver must use the normal memory barrier instructions even in
>coherent memory.
I know Documentation/DMA-mapping.txt says that, and I
understand that wmb() is necessary with consistent memory, but I
wonder if rmb() really is, at least if you've declared the data
structures in question as volatile to prevent reordering of reads by
the compiler.
>- kmalloc (32,GFP_KERNEL) returns a 32-byte object, even if the cache
>line size is 128 bytes. The 4 objects in the cache line could be used
>by four different users. - sendfile() with an odd offset.
+1 Insightful
I think we could use a GFP_ flag for kmallocs that are
intended for DMA (typically networking and USB packets) that would
cause the memory allocation to be aligned and rounded up to a multiple
of cache line size. There probably are only a dozen or so such
kmallocs, but I think it's enough so that having a kmalloc flag
would result in a smaller kernel than without it.
As you've pointed out with your sendfile() example, the
problem you've identified goes beyond kmalloc. I'm still mulling it
over, but it's worth noting that it is not a new problem introduced by
the generic DMA interface. Thanks for raising it though. I hadn't
thought of it before.
Adam J. Richter __ ______________ 575 Oroville Road
adam@yggdrasil.com \ / Milpitas, California 95035
+1 408 309-6081 | g g d r a s i l United States of America
"Free Software For The Rest Of Us."
-
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/