From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755454AbcFGNAV (ORCPT ); Tue, 7 Jun 2016 09:00:21 -0400 Received: from mail.kernel.org ([198.145.29.136]:37366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754106AbcFGNAT (ORCPT ); Tue, 7 Jun 2016 09:00:19 -0400 Date: Tue, 7 Jun 2016 20:59:13 +0800 From: Shawn Guo To: linux-kernel@vger.kernel.org, inux-arm-kernel@lists.infradead.org Cc: Marek Szyprowski , Arnd Bergmann , Laurent Pinchart , Michal Nazarewicz , Vlastimil Babka , Laura Abbott , Minchan Kim , Joonsoo Kim , Shawn Guo Subject: CMA region absolutely for a particular device? Message-ID: <20160607125911.GA4279@tiger> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I'm using a separate CMA region than the system default one for a particular device to avoid fragmentation. It does help. But under certain circumstance (memory shortage), it seems some of the pages in the region will be used by system. The really bad thing is that when a CMA allocation tries to move these occupied pages around, it just fails to do so with messages like "alloc_contig_range: ... PFNs busy". These pages thus become holes in a contiguous block and prevent the allocation from succeeding. Is it possible to make a CMA absolutely for a particular device, and even system movable pages cannot use the memory? I can reserve a memory region from kernel and manage it with some custom and private interface for that particular device. But obviously, the standard dma-mapping API and established underneath CMA infrastructural is more desirable to use, right? This is an arm64 device running on 4.1 kernel. Any comments or suggestions will be appreciated. Thanks. Shawn