linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Aslan Bakirov <aslan@fb.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, kernel-team@fb.com, riel@surriel.com,
	guro@fb.com, mhocko@kernel.org, hannes@cmpxchg.org
Subject: Re: [PATCH v2] mm: cma: NUMA node interface
Date: Thu, 2 Apr 2020 15:07:13 -0700	[thread overview]
Message-ID: <20200402220713.GO21484@bombadil.infradead.org> (raw)
In-Reply-To: <20200402215810.1898270-1-aslan@fb.com>

On Thu, Apr 02, 2020 at 02:58:10PM -0700, Aslan Bakirov wrote:
> I've noticed that there is no interfaces exposed by CMA which would let me
> to declare contigous memory on particular NUMA node.

Do you have a user for this functionality?

> +++ b/include/linux/cma.h
> @@ -24,10 +24,20 @@ extern phys_addr_t cma_get_base(const struct cma *cma);
>  extern unsigned long cma_get_size(const struct cma *cma);
>  extern const char *cma_get_name(const struct cma *cma);
>  
> -extern int __init cma_declare_contiguous(phys_addr_t base,
> +extern int __init cma_declare_contiguous_nid(phys_addr_t base,
>  			phys_addr_t size, phys_addr_t limit,
>  			phys_addr_t alignment, unsigned int order_per_bit,
> -			bool fixed, const char *name, struct cma **res_cma);
> +			bool fixed, const char *name, struct cma **res_cma,
> +			int nid);
> +static inline int __init cma_declare_contiguous(phys_addr_t base,
> +			phys_addr_t size, phys_addr_t limit,
> +			phys_addr_t alignment, unsigned int order_per_bit,
> +			bool fixed, const char *name, struct cma **res_cma)
> +			{
> +				return cma_declare_contiguous_nid(base, size,
> +						limit, alignment, order_per_bit,
> +						fixed, name, res_cma, NUMA_NO_NODE);
> +			}

... what even is this indentation?

> +phys_addr_t memblock_alloc_range_nid(phys_addr_t size,
> +					  phys_addr_t align, phys_addr_t start,
> +					  phys_addr_t end, int nid, bool exact_nid);

>80 columns.  checkpatch should warn you of nits like this.

>  		if (base < highmem_start && limit > highmem_start) {
> -			addr = memblock_phys_alloc_range(size, alignment,
> -							 highmem_start, limit);
> +			addr = memblock_alloc_range_nid(size, alignment,
> +							 highmem_start, limit, nid, false);

The deep indentation makes it hard to add new parameters.  I'd do it as:
			addr = memblock_alloc_range_nid(size, alignment,
					highmem_start, limit, nid, false);



  reply	other threads:[~2020-04-02 22:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-02 21:58 Aslan Bakirov
2020-04-02 22:07 ` Matthew Wilcox [this message]
2020-04-02 22:26   ` Aslan Bakirov

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=20200402220713.GO21484@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=aslan@fb.com \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=riel@surriel.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