Does pci_alloc_consisent really need to zero memory?
Is it really necessary for pci_alloc_consistent() to
fill the memory that it returns with all zeroes? I don't see anything in Documentation/DMA-mapping.txt that specifies it. I have been on the lookout for drivers that rely on it for the past couple of months, and I haven't seen any. It's only one line of code in arch/i386/kernel/pci-dma.c, but it is potentially a lot of cycles, even if only zeroes the space you requested (rather than the full pages that it actually allocates).
If nobody objects in the next half day or so (or asks
me to follow some other course of action), I'll submit a patch for 2.5 for all architectures.
Adam J. Richter __ ______________ 575 Oroville Road [email protected] \ / 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."
From: "Adam J. Richter" <[email protected]>
Date: Thu, 30 May 2002 02:11:12 -0700
Is it really necessary for pci_alloc_consistent() to
fill the memory that it returns with all zeroes? I don't see anything in Documentation/DMA-mapping.txt that specifies it. I have been on the lookout for drivers that rely on it for the past couple of months, and I haven't seen any. It's only one line of code in arch/i386/kernel/pci-dma.c, but it is potentially a lot of cycles, even if only zeroes the space you requested (rather than the full pages that it actually allocates).
pci_alloc_consistent is so rare, I doubt it matters performance wise.
I'd rather see a patch to DMA-mapping.txt that specifies the memory returned is zeroed out, as this is what every implementation appears to do.
Quoted 3 lines · David S. Miller
I'd rather see a patch to DMA-mapping.txt that specifies the memory returned is zeroed out, as this is what every implementation appears to do.
What was the idea when writing the code that zeroes memory? It seems so useless.
Sincerely yours,
Signature · 4 lines
Emmanuel Michon Chef de projet REALmagic France SAS Mobile: 0614372733 GPGkeyID: D2997E42
From: Emmanuel Michon <[email protected]>
Date: 30 May 2002 13:05:26 +0200
Quoted 3 lines · David S. Miller
I'd rather see a patch to DMA-mapping.txt that specifies the memory returned is zeroed out, as this is what every implementation appears to do.
What was the idea when writing the code that zeroes memory? It seems so useless.
Because 9 out of 10 drivers where I had to change virt_to_bus into the portable pci_alloc_consistent were using get_free_pages() which zeros things out for you.
I do actually remember that many of those instances in fact did depend on the memory being zero'd for them, they weren't using the "zero the pages too" variant instead of __get_free_pages() gratuitously.