aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-09-08 20:53:04 -0400
committerDan Williams <dan.j.williams@intel.com>2009-09-08 20:53:04 -0400
commit162b96e63e518aa6ff029ce23de12d7f027483bf (patch)
tree532191d0cef7cf975b70a07b1c69a293d6f552f7 /drivers/dma
parent0803172778901e24a75ab074798d98c2b7411559 (diff)
ioat2,3: cacheline align software descriptor allocations
All the necessary fields for handling an ioat2,3 ring entry can fit into one cacheline. Move ->len prior to ->txd in struct ioat_ring_ent, and move allocation of these entries to a hw-cache-aligned kmem cache to reduce the number of cachelines dirtied for descriptor management. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/ioat/dma_v2.c5
-rw-r--r--drivers/dma/ioat/dma_v2.h3
-rw-r--r--drivers/dma/ioat/pci.c16
3 files changed, 20 insertions, 4 deletions
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index 460b77301332..fa3d6db6624c 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -399,11 +399,12 @@ static struct ioat_ring_ent *ioat2_alloc_ring_ent(struct dma_chan *chan, gfp_t f
399 return NULL; 399 return NULL;
400 memset(hw, 0, sizeof(*hw)); 400 memset(hw, 0, sizeof(*hw));
401 401
402 desc = kzalloc(sizeof(*desc), flags); 402 desc = kmem_cache_alloc(ioat2_cache, flags);
403 if (!desc) { 403 if (!desc) {
404 pci_pool_free(dma->dma_pool, hw, phys); 404 pci_pool_free(dma->dma_pool, hw, phys);
405 return NULL; 405 return NULL;
406 } 406 }
407 memset(desc, 0, sizeof(*desc));
407 408
408 dma_async_tx_descriptor_init(&desc->txd, chan); 409 dma_async_tx_descriptor_init(&desc->txd, chan);
409 desc->txd.tx_submit = ioat2_tx_submit_unlock; 410 desc->txd.tx_submit = ioat2_tx_submit_unlock;
@@ -418,7 +419,7 @@ static void ioat2_free_ring_ent(struct ioat_ring_ent *desc, struct dma_chan *cha
418 419
419 dma = to_ioatdma_device(chan->device); 420 dma = to_ioatdma_device(chan->device);
420 pci_pool_free(dma->dma_pool, desc->hw, desc->txd.phys); 421 pci_pool_free(dma->dma_pool, desc->hw, desc->txd.phys);
421 kfree(desc); 422 kmem_cache_free(ioat2_cache, desc);
422} 423}
423 424
424static struct ioat_ring_ent **ioat2_alloc_ring(struct dma_chan *c, int order, gfp_t flags) 425static struct ioat_ring_ent **ioat2_alloc_ring(struct dma_chan *c, int order, gfp_t flags)
diff --git a/drivers/dma/ioat/dma_v2.h b/drivers/dma/ioat/dma_v2.h
index 9baa3d6065ff..ac00adc81974 100644
--- a/drivers/dma/ioat/dma_v2.h
+++ b/drivers/dma/ioat/dma_v2.h
@@ -116,8 +116,8 @@ static inline u16 ioat2_xferlen_to_descs(struct ioat2_dma_chan *ioat, size_t len
116 116
117struct ioat_ring_ent { 117struct ioat_ring_ent {
118 struct ioat_dma_descriptor *hw; 118 struct ioat_dma_descriptor *hw;
119 struct dma_async_tx_descriptor txd;
120 size_t len; 119 size_t len;
120 struct dma_async_tx_descriptor txd;
121 #ifdef DEBUG 121 #ifdef DEBUG
122 int id; 122 int id;
123 #endif 123 #endif
@@ -143,4 +143,5 @@ int __devinit ioat2_dma_probe(struct ioatdma_device *dev, int dca);
143int __devinit ioat3_dma_probe(struct ioatdma_device *dev, int dca); 143int __devinit ioat3_dma_probe(struct ioatdma_device *dev, int dca);
144struct dca_provider * __devinit ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase); 144struct dca_provider * __devinit ioat2_dca_init(struct pci_dev *pdev, void __iomem *iobase);
145struct dca_provider * __devinit ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase); 145struct dca_provider * __devinit ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase);
146extern struct kmem_cache *ioat2_cache;
146#endif /* IOATDMA_V2_H */ 147#endif /* IOATDMA_V2_H */
diff --git a/drivers/dma/ioat/pci.c b/drivers/dma/ioat/pci.c
index c4e432269252..61086c6bbf42 100644
--- a/drivers/dma/ioat/pci.c
+++ b/drivers/dma/ioat/pci.c
@@ -69,6 +69,8 @@ static int ioat_dca_enabled = 1;
69module_param(ioat_dca_enabled, int, 0644); 69module_param(ioat_dca_enabled, int, 0644);
70MODULE_PARM_DESC(ioat_dca_enabled, "control support of dca service (default: 1)"); 70MODULE_PARM_DESC(ioat_dca_enabled, "control support of dca service (default: 1)");
71 71
72struct kmem_cache *ioat2_cache;
73
72#define DRV_NAME "ioatdma" 74#define DRV_NAME "ioatdma"
73 75
74static struct pci_driver ioat_pci_driver = { 76static struct pci_driver ioat_pci_driver = {
@@ -168,12 +170,24 @@ static void __devexit ioat_remove(struct pci_dev *pdev)
168 170
169static int __init ioat_init_module(void) 171static int __init ioat_init_module(void)
170{ 172{
171 return pci_register_driver(&ioat_pci_driver); 173 int err;
174
175 ioat2_cache = kmem_cache_create("ioat2", sizeof(struct ioat_ring_ent),
176 0, SLAB_HWCACHE_ALIGN, NULL);
177 if (!ioat2_cache)
178 return -ENOMEM;
179
180 err = pci_register_driver(&ioat_pci_driver);
181 if (err)
182 kmem_cache_destroy(ioat2_cache);
183
184 return err;
172} 185}
173module_init(ioat_init_module); 186module_init(ioat_init_module);
174 187
175static void __exit ioat_exit_module(void) 188static void __exit ioat_exit_module(void)
176{ 189{
177 pci_unregister_driver(&ioat_pci_driver); 190 pci_unregister_driver(&ioat_pci_driver);
191 kmem_cache_destroy(ioat2_cache);
178} 192}
179module_exit(ioat_exit_module); 193module_exit(ioat_exit_module);