Skip to content

Commit

Permalink
[PARISC] Use page allocator instead of slab allocator in pci-dma.c
Browse files Browse the repository at this point in the history
Slab pages obtained via kmalloc are not cacheline aligned.  Nor is it
advisable to perform VM operations designed for page allocator pages on
memory obtained via kmalloc.

So replace the page sized allocations in kernel/pci-dma.c with page allocator
pages.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: Matthew Wilcox <willy@debian.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
  • Loading branch information
Christoph Lameter authored and Kyle McMartin committed Oct 18, 2007
1 parent f13cec8 commit 6f7d998
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions arch/parisc/kernel/pci-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,10 @@ static void *fail_alloc_consistent(struct device *dev, size_t size,
static void *pa11_dma_alloc_noncoherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
void *addr = NULL;
void *addr;

/* rely on kmalloc to be cacheline aligned */
addr = kmalloc(size, flag);
if(addr)
addr = (void *)__get_free_pages(flag, get_order(size));
if (addr)
*dma_handle = (dma_addr_t)virt_to_phys(addr);

return addr;
Expand All @@ -582,7 +581,7 @@ static void *pa11_dma_alloc_noncoherent(struct device *dev, size_t size,
static void pa11_dma_free_noncoherent(struct device *dev, size_t size,
void *vaddr, dma_addr_t iova)
{
kfree(vaddr);
free_pages((unsigned long)vaddr, get_order(size));
return;
}

Expand Down

0 comments on commit 6f7d998

Please sign in to comment.