Received: by 10.223.164.202 with SMTP id h10csp1752055wrb; Mon, 27 Nov 2017 07:03:06 -0800 (PST) X-Google-Smtp-Source: AGs4zMZSqHbVhxroIOBu+MYl7Cf8SfjyNujfXQLPgH28yX+j4Nz7dDG7xVT1kUmXXGY8RhY4vV+M X-Received: by 10.98.162.20 with SMTP id m20mr27279803pff.6.1511794986080; Mon, 27 Nov 2017 07:03:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511794986; cv=none; d=google.com; s=arc-20160816; b=Ict+x0HRFHI4IZJO3JGypMR3/13S54C9vLr8TRr+Jgg3r4TZBc+GvRNRnCnLKJK47S 2h1fHbaRhG05atqW0saB+aMIl5DknfQSsUh8ZrrwfLZSnw3v1hcgzDP+xZXdPTdGiiIy tV0tauKnFC97T3sCSW16gmfTDf5HaBNcDi1fUWzDlnJYIcBV+C0C68te3tndpHWv6yHB Irh4+W6w4heEsnYOXPQs4Y0ROZbt0H2rT5F1wZNNStZb8JHFkpgECKffv1rLPUnXxYJk X0y0IM+eHOJJ3JRxEdj6WEXNyBUicZ8TMAMspH1CLe5RqCTBu1VrlJSpOPOthF0R5YyA s7DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=WLDO518Z5kyy0llvLDCbPf0kWx4xwCi03WcfpKvzQKI=; b=g9ZxQGVaHtlEfN71Avr1HwdP6gIhe0BUM1Att0RN7bmD6ZQZT74TYSaXUzx3BAnMsp ROiz3wVmYbVfXF9tf9vBVxHDNJYimdnim+/w6w6pOi1/OPnxaXPM3A6RFHMWeT6rJbc4 iWWwYDGvLiNHPNPOBYXrCAZOWi//scsnN2AZebwLG5ka5hcxseAHpQTUjb+7PcEbdnWC izBmwAEg7j5LPSKPgBYCF2EjsRzlFjWPYae+GItD3lxjVkx2cwWy6ZCcv9HscBTwwDAk tjiKICxxVs22uCnPbWV/Fvx+n8SylLZ9qMxCgCfrdfPN3VWy/5QSXrRCGLiRiSaLua5Q 3EEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q9M4uTbq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v136si22537427pgb.283.2017.11.27.07.02.53; Mon, 27 Nov 2017 07:03:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q9M4uTbq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752372AbdK0Nr7 (ORCPT + 77 others); Mon, 27 Nov 2017 08:47:59 -0500 Received: from mail-oi0-f47.google.com ([209.85.218.47]:40588 "EHLO mail-oi0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752179AbdK0Nr6 (ORCPT ); Mon, 27 Nov 2017 08:47:58 -0500 Received: by mail-oi0-f47.google.com with SMTP id l138so19388589oib.7 for ; Mon, 27 Nov 2017 05:47:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=WLDO518Z5kyy0llvLDCbPf0kWx4xwCi03WcfpKvzQKI=; b=Q9M4uTbqSPSOm4qx3EqAv1kk1BLWtPatN9/fZYU0nY0+3g6OmcRMn5EVj8RTDElvHm ldKRnODbrtXcfV/WekfkfEyU9huGjnJ9cVtkRE0wWBpWyFrGgDfT6S+WR+m6G5QIhaoz +GEOl6fGlNfGSEyPVOw9TaMUPLkRJfxD02tmcSNj9amgtcx6H277mHcqRds14IorDGfj tEITiSg3wBK95G35ul0bQpZWngzxjC92y68krjwk0tYC9SAlY5GNq0KF0+tJgXzHG5sd LtCKymQrPl/c51l8EUnL9kocy/QnP0jL1LtaQeAjHVRa61Foj4igImm2i13XrUjZ9eTT sdaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=WLDO518Z5kyy0llvLDCbPf0kWx4xwCi03WcfpKvzQKI=; b=YVExPxnBhb20hLP6J+Ny/jFSqVHgXA2leRcQrhsuUZBvgBNyCzIBZvdgprMH/VhLLI SmlLnMG6pKMkGX6haFzYDbGvo+b1xAQ6SX4gYd0ODzP6X1Dtj+I3f/5ioMmwurQSh+Vv ZN09JrDgcfUjlSPvCVppPAwdXzYCvTG9UY9OHQbt0xMcJDETHlMA3O5ZQzNRGgjd5Ku8 CpJ0qui6RV5jNPsFnzasOjcLebGssig5Pck0KXbiCpJHKEKZ7tnQKi8Ra5hz+Rp9ng6z sVGBWwvS8VGA9HtGa87YzpElWdCW0PZrQYTk8fTZuDV6UFarLeyngsxD/kBRcl8tTMJj vnUw== X-Gm-Message-State: AJaThX7wW+NMwTAP9RuSfJgJ4aVbMjlP3PtMhm/e8ZKQA2y2oYffh3mR AfRJ26FNkZu3pUSenp1+czpiSbLQa97SE+eluQU= X-Received: by 10.202.198.83 with SMTP id w80mr16267311oif.139.1511790477515; Mon, 27 Nov 2017 05:47:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.168.71.204 with HTTP; Mon, 27 Nov 2017 05:47:57 -0800 (PST) In-Reply-To: References: <20171124055833.10998-1-jaewon31.kim@samsung.com> From: Jaewon Kim Date: Mon, 27 Nov 2017 22:47:57 +0900 Message-ID: Subject: Re: [RFC v2] dma-coherent: introduce no-align to avoid allocation failure and save memory To: David Laight Cc: Jaewon Kim , "m.szyprowski@samsung.com" , "hch@lst.de" , "robin.murphy@arm.com" , "gregkh@linuxfoundation.org" , "iommu@lists.linux-foundation.org" , "akpm@linux-foundation.org" , "mhocko@suse.com" , "vbabka@suse.cz" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello 2017-11-24 19:35 GMT+09:00 David Laight : > From: Jaewon Kim >> Sent: 24 November 2017 05:59 >> >> dma-coherent uses bitmap APIs which internally consider align based on the >> requested size. If most of allocations are small size like KBs, using >> alignment scheme seems to be good for anti-fragmentation. But if large >> allocation are commonly used, then an allocation could be failed because >> of the alignment. To avoid the allocation failure, we had to increase total >> size. >> >> This is a example, total size is 30MB, only few memory at front is being >> used, and 9MB is being requsted. Then 9MB will be aligned to 16MB. The >> first try on offset 0MB will be failed because others already are using >> them. The second try on offset 16MB will be failed because of ouf of bound. >> >> So if the alignment is not necessary on a specific dma-coherent memory >> region, we can set no-align property. Then dma-coherent will ignore the >> alignment only for the memory region. > > ISTM that the alignment needs to be a property of the request, not of the > device. Certainly the device driver code is most likely to know the specific > alignment requirements of any specific allocation. > Sorry but I'm not fully understand on 'a property of the request'. Actually dma-coherent APIs does not get alignment through argument but it internally uses get_order to determine alignment according to a requested size. I think if you meant that dma-coherent APIs should work in that way because drivers calling to dma-coherent APIs have been assuming the alignment for a long time. I still think few memory region could be managed without alignment if author knows well and adds no-align into its device tree. But it's OK if open source community worried about the no-alignment. Thank you > We've some hardware that would need large allocations to be 16k aligned. > We actually use multiple 16k allocations because any large buffers are > accessed directly from userspace (mmap and vm_iomap_memory) and the > card has its own page tables (with 16k pages). > > David > From 1584943388197663116@xxx Fri Nov 24 10:36:42 +0000 2017 X-GM-THRID: 1584925924802395555 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread