linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org,
	Roman Gushchin <guro@fb.com>,
	Barry Song <song.bao.hua@hisilicon.com>,
	Joonsoo Kim <js1304@gmail.com>, Rik van Riel <riel@surriel.com>,
	Aslan Bakirov <aslan@fb.com>, Michal Hocko <mhocko@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC PATCH] cma: make number of CMA areas dynamic, remove CONFIG_CMA_AREAS
Date: Wed, 16 Sep 2020 05:32:07 +0100	[thread overview]
Message-ID: <20200916043207.GA713@infradead.org> (raw)
In-Reply-To: <20200903030204.253433-1-mike.kravetz@oracle.com>

On Wed, Sep 02, 2020 at 08:02:04PM -0700, Mike Kravetz wrote:
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -383,25 +383,34 @@ postcore_initcall(atomic_pool_init);
>  struct dma_contig_early_reserve {
>  	phys_addr_t base;
>  	unsigned long size;
> +	struct list_head areas;
>  };
>  
> +static __initdata LIST_HEAD(dma_mmu_remap_areas);
>  
>  void __init dma_contiguous_early_fixup(phys_addr_t base, unsigned long size)
>  {
> +	struct dma_contig_early_reserve *d;
> +
> +	d = memblock_alloc(sizeof(struct dma_contig_early_reserve),
> +			sizeof(void *));
> +	if (!d) {
> +		pr_err("Unable to allocate dma_contig_early_reserve struct!\n");
> +		return;
> +	}
> +
> +	d->base = base;
> +	d->size = size;
> +	list_add_tail(&d->areas, &dma_mmu_remap_areas);
>  }

I wonder if struct cma should grow a flags or type field, so that the
arm code can simply use cma_for_each_area to iterate the CMA areas for
the DMA fixup, and we can remove the extra list and the magic hook.

> +/* modify here */
> +LIST_HEAD(cma_areas);

What does this comment mean?

> +static unsigned int cma_area_count;

It seems this is only used to provide a default name for the CMA
areas, but all areas actually provide a name, so I think we can drop
the default naming and the cma_area_count variable entirely.

>  	if (!size || !memblock_is_region_reserved(base, size))
>  		return -EINVAL;
>  
> +
>  	/* ensure minimal alignment required by mm core */

This adds a spurious empty line.

>  static int __init cma_debugfs_init(void)
>  {
>  	struct dentry *cma_debugfs_root;
> -	int i;
> +	struct cma *c;
>  
>  	cma_debugfs_root = debugfs_create_dir("cma", NULL);
>  
> -	for (i = 0; i < cma_area_count; i++)
> -		cma_debugfs_add_one(&cma_areas[i], cma_debugfs_root);
> +	list_for_each_entry(c, &cma_areas, areas)
> +		cma_debugfs_add_one(c, cma_debugfs_root);

I think this should use cma_for_each_area, that way cma_areas can be
keep static in cma.c.


  parent reply	other threads:[~2020-09-16  4:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  3:02 Mike Kravetz
2020-09-03 20:34 ` Roman Gushchin
2020-09-04  1:58 ` Song Bao Hua (Barry Song)
2020-09-08 18:29   ` Mike Kravetz
2020-09-08 22:57     ` Song Bao Hua (Barry Song)
2020-09-16  4:32 ` Christoph Hellwig [this message]
2020-09-16 17:30   ` Mike Kravetz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200916043207.GA713@infradead.org \
    --to=hch@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=aslan@fb.com \
    --cc=guro@fb.com \
    --cc=js1304@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mike.kravetz@oracle.com \
    --cc=riel@surriel.com \
    --cc=song.bao.hua@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox