Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753209Ab2BVQ1D (ORCPT ); Wed, 22 Feb 2012 11:27:03 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:14513 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888Ab2BVQ1A (ORCPT ); Wed, 22 Feb 2012 11:27:00 -0500 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii Date: Wed, 22 Feb 2012 17:26:43 +0100 From: Marek Szyprowski Subject: RE: [PATCHv22 13/16] drivers: add Contiguous Memory Allocator In-reply-to: To: "'Aaro Koskinen'" Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-mm@kvack.org, linaro-mm-sig@lists.linaro.org, "'Michal Nazarewicz'" , "'Kyungmin Park'" , "'Russell King'" , "'Andrew Morton'" , "'KAMEZAWA Hiroyuki'" , "'Daniel Walker'" , "'Mel Gorman'" , "'Arnd Bergmann'" , "'Jesse Barker'" , "'Jonathan Corbet'" , "'Shariq Hasnain'" , "'Chunsang Jeong'" , "'Dave Hansen'" , "'Benjamin Gaignard'" , "'Rob Clark'" , "'Ohad Ben-Cohen'" Message-id: <000001ccf17e$c3e50040$4baf00c0$%szyprowski@samsung.com> Organization: SPRC X-Mailer: Microsoft Office Outlook 12.0 Content-language: pl Thread-index: Aczw4ACUXapK7zqmQ0uq7qn8Sm07iwAUZ2GA References: <1329507036-24362-1-git-send-email-m.szyprowski@samsung.com> <1329507036-24362-14-git-send-email-m.szyprowski@samsung.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1464 Lines: 48 Hello, On Tuesday, February 21, 2012 10:30 PM Aaro Koskinen wrote: > On Fri, 17 Feb 2012, Marek Szyprowski wrote: > > +/** > > + * dma_release_from_contiguous() - release allocated pages > > + * @dev: Pointer to device for which the pages were allocated. > > + * @pages: Allocated pages. > > + * @count: Number of allocated pages. > > + * > > + * This function releases memory allocated by dma_alloc_from_contiguous(). > > + * It returns false when provided pages do not belong to contiguous area and > > + * true otherwise. > > + */ > > +bool dma_release_from_contiguous(struct device *dev, struct page *pages, > > + int count) > > +{ > > + struct cma *cma = dev_get_cma_area(dev); > > + unsigned long pfn; > > + > > + if (!cma || !pages) > > + return false; > > + > > + pr_debug("%s(page %p)\n", __func__, (void *)pages); > > + > > + pfn = page_to_pfn(pages); > > + > > + if (pfn < cma->base_pfn || pfn >= cma->base_pfn + cma->count) > > + return false; > > + > > + VM_BUG_ON(pfn + count > cma->base_pfn); > > Are you sure the VM_BUG_ON() condition is correct here? Thanks for pointing this bug. '+ cma->count' is missing in the second part. Best regards -- Marek Szyprowski Samsung Poland R&D Center -- 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/