lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190205230514.GA21515@Asurada-Nvidia.nvidia.com>
Date:   Tue, 5 Feb 2019 15:05:30 -0800
From:   Nicolin Chen <nicoleotsuka@...il.com>
To:     Christoph Hellwig <hch@....de>
Cc:     m.szyprowski@...sung.com, robin.murphy@....com, vdumpa@...dia.com,
        iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] dma-direct: do not allocate a single page from CMA
 area

Hi Christoph

On Mon, Feb 04, 2019 at 09:23:07AM +0100, Christoph Hellwig wrote:
> On Tue, Jan 15, 2019 at 01:51:40PM -0800, Nicolin Chen wrote:
> > The addresses within a single page are always contiguous, so it's
> > not so necessary to allocate one single page from CMA area. Since
> > the CMA area has a limited predefined size of space, it might run
> > out of space in some heavy use case, where there might be quite a
> > lot CMA pages being allocated for single pages.
> > 
> > This patch tries to skip CMA allocations of single pages and lets
> > them go through normal page allocations unless the allocation has
> > a DMA_ATTR_FORCE_CONTIGUOUS attribute. This'd save some resources
> > in the CMA area for further more CMA allocations, and it can also
> > reduce CMA fragmentations resulted from trivial allocations.
> 
> That DMA_ATTR_FORCE_CONTIGUOUS flag does not make sense.  A single
> page allocation is per defintion always contigous.
> 
> >  again:
> > -	/* CMA can be used only in the context which permits sleeping */
> > -	if (gfpflags_allow_blocking(gfp)) {
> > +	/*
> > +	 * CMA can be used only in the context which permits sleeping.
> > +	 * Since addresses within one PAGE are always contiguous, skip
> > +	 * CMA allocation for a single page to save CMA reserved space
> > +	 * unless DMA_ATTR_FORCE_CONTIGUOUS is flagged.
> > +	 */
> > +	if (gfpflags_allow_blocking(gfp) &&
> > +	    (count > 1 || attrs & DMA_ATTR_FORCE_CONTIGUOUS)) {
> 
> And my other concern is that this skips allocating from the per-device
> pool, which drivers might rely on.

Actually Robin had the same concern at v1 and suggested that we could
always use DMA_ATTR_FORCE_CONTIGUOUS to enforce into per-device pool.

> To be honest I'm not sure there is
> much of a point in the per-device CMA pool vs the traditional per-device
> coherent pool, but I'd rather change that behavior in a clearly documented
> commit with intentions rather as a side effect from a random optimization.

Hmm..sorry, I don't really follow this suggestion. Is it possible for
you to make it clear that what should I do for the change?

Thanks
Nicolin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ