From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qg0-f43.google.com (mail-qg0-f43.google.com [209.85.192.43]) by kanga.kvack.org (Postfix) with ESMTP id 0F7556B0073 for ; Tue, 4 Nov 2014 16:03:54 -0500 (EST) Received: by mail-qg0-f43.google.com with SMTP id f51so11073017qge.2 for ; Tue, 04 Nov 2014 13:03:53 -0800 (PST) Received: from mail-qg0-x235.google.com (mail-qg0-x235.google.com. [2607:f8b0:400d:c04::235]) by mx.google.com with ESMTPS id 35si2633236qgl.127.2014.11.04.13.03.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Nov 2014 13:03:53 -0800 (PST) Received: by mail-qg0-f53.google.com with SMTP id z107so11009480qgd.26 for ; Tue, 04 Nov 2014 13:03:52 -0800 (PST) MIME-Version: 1.0 From: Gregory Fong Date: Tue, 4 Nov 2014 13:03:22 -0800 Message-ID: Subject: CMA alignment question Content-Type: text/plain; charset=UTF-8 Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: lauraa@codeaurora.org, iamjoonsoo.kim@lge.com, mina86@mina86.com, Marek Szyprowski , "linux-kernel@vger.kernel.org" , Florian Fainelli , Brian Norris Hi all, The alignment in cma_alloc() is done w.r.t. the bitmap. This is a problem when, for example: - a device requires 16M (order 12) alignment - the CMA region is not 16 M aligned In such a case, can result with the CMA region starting at, say, 0x2f800000 but any allocation you make from there will be aligned from there. Requesting an allocation of 32 M with 16 M alignment, will result in an allocation from 0x2f800000 to 0x31800000, which doesn't work very well if your strange device requires 16M alignment. This doesn't have the behavior I would expect, which would be for the allocation to be aligned w.r.t. the start of memory. I realize that aligning the CMA region is an option, but don't see why cma_alloc() aligns to the start of the CMA region. Is there a good reason for having cma_alloc() alignment work this way? Thanks and regards, Gregory -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org