All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: skseofh@gmail.com
Cc: robh@kernel.org, saravanak@google.com, akpm@linux-foundation.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, Daero Lee <daero_le.lee@samsung.com>
Subject: Re: [PATCH] memblock: add no-map alloc functions
Date: Mon, 15 Apr 2024 18:26:55 +0300	[thread overview]
Message-ID: <Zh1HP8IWWjexAUKN@kernel.org> (raw)
In-Reply-To: <20240415142448.333271-1-skseofh@gmail.com>

On Mon, Apr 15, 2024 at 11:24:48PM +0900, skseofh@gmail.com wrote:
> From: Daero Lee <daero_le.lee@samsung.com>
> 
> Like reserved-memory with the no-map property, there are memory regions
> need to be allocated in memblock.memory marked with the
> MEMBLOCK_NOMAP flag, but sholud not be allocated in memblock.reserved.

Can you please explain your use case?
Why do you need this functionality?
 
> So, functions were added that find the required memory area in
> memblock.memory, but do not allocate it to memblock.reserved.
> 
> The early_init_dt_alloc_reserved_memory_arch function was modified
> using the no-map alloc function.
> 
> Signed-off-by: Daero Lee <daero_le.lee@samsung.com>
> ---
>  drivers/of/of_reserved_mem.c |  9 +++--
>  mm/memblock.c                | 78 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 84 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
> index 8236ecae2953..504f2f60689c 100644
> --- a/drivers/of/of_reserved_mem.c
> +++ b/drivers/of/of_reserved_mem.c
> @@ -40,15 +40,18 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
>  
>  	end = !end ? MEMBLOCK_ALLOC_ANYWHERE : end;
>  	align = !align ? SMP_CACHE_BYTES : align;
> -	base = memblock_phys_alloc_range(size, align, start, end);
> +	if (nomap) {
> +		base = memblock_phys_alloc_range_nomap(size, align, start, end);
> +	} else {
> +		base = memblock_phys_alloc_range(size, align, start, end);
> +	}
> +	

This changes behaviour of internal function, what effect will it have on
the users?

>  	if (!base)
>  		return -ENOMEM;
>  
>  	*res_base = base;
>  	if (nomap) {
>  		err = memblock_mark_nomap(base, size);
> -		if (err)
> -			memblock_phys_free(base, size);
>  	}
>  
>  	kmemleak_ignore_phys(base);

-- 
Sincerely yours,
Mike.

  reply	other threads:[~2024-04-15 15:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15 14:24 [PATCH] memblock: add no-map alloc functions skseofh
2024-04-15 15:26 ` Mike Rapoport [this message]
2024-04-17  2:31   ` Wei Yang
2024-04-17  5:54     ` Mike Rapoport
2024-04-16 13:41 ` Wei Yang

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=Zh1HP8IWWjexAUKN@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=daero_le.lee@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=skseofh@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.