From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752126AbXFVUPd (ORCPT ); Fri, 22 Jun 2007 16:15:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751266AbXFVUPZ (ORCPT ); Fri, 22 Jun 2007 16:15:25 -0400 Received: from netops-testserver-4-out.sgi.com ([192.48.171.29]:48311 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751199AbXFVUPZ (ORCPT ); Fri, 22 Jun 2007 16:15:25 -0400 Date: Fri, 22 Jun 2007 13:15:19 -0700 (PDT) From: Christoph Lameter X-X-Sender: clameter@schroedinger.engr.sgi.com To: Hugh Dickins cc: Linus Torvalds , Nicolas Ferre , ARM Linux Mailing List , Linux Kernel list , Marc Pignat , Andrew Victor , Pierre Ossman , Andrew Morton , Russell King Subject: Re: Oops in a driver while using SLUB as a SLAB allocator In-Reply-To: Message-ID: References: <467A4532.40301@rfo.atmel.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Here is the corresponding PA-RISC piece. Its as straightforward as the other one since the only way to make this work properly in the past was if the sizes passed to the dma alloc functions are page size based. PA-RISC: Use page allocator instead of slab allocator. Slab pages obtained via kmalloc are not cachline 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 --- arch/parisc/kernel/pci-dma.c | 4 ++-- include/linux/mm.h | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) Index: linux-2.6/arch/parisc/kernel/pci-dma.c =================================================================== --- linux-2.6.orig/arch/parisc/kernel/pci-dma.c 2007-06-22 13:02:32.000000000 -0700 +++ linux-2.6/arch/parisc/kernel/pci-dma.c 2007-06-22 13:06:39.000000000 -0700 @@ -572,7 +572,7 @@ static void *pa11_dma_alloc_noncoherent( void *addr = NULL; /* rely on kmalloc to be cacheline aligned */ - addr = kmalloc(size, flag); + addr = (void *)__get_free_pages(flag, get_order(size)); if(addr) *dma_handle = (dma_addr_t)virt_to_phys(addr); @@ -582,7 +582,7 @@ static void *pa11_dma_alloc_noncoherent( 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; }