linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] memblock: export memblock_free() to free reserved memory.
@ 2024-06-25 12:16 Guanshun Liu
  2024-06-25 15:53 ` Christoph Hellwig
  2024-06-26  5:02 ` Mike Rapoport
  0 siblings, 2 replies; 6+ messages in thread
From: Guanshun Liu @ 2024-06-25 12:16 UTC (permalink / raw)
  To: rppt; +Cc: akpm, linux-mm, linux-kernel, Guanshun Liu

On architectures that support the preservation of memblock metadata
after __init, allow drivers to call memblock_free() to free a
reservation configured in dts. This is a hack to support the
freeing of bootsplash reservations passed to Linux by the bootloader.

Signed-off-by: Guanshun Liu <lgs156412@gmail.com>
---
 mm/memblock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/memblock.c b/mm/memblock.c
index 6d18485571b4..20e7f81fc076 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -848,6 +848,9 @@ void __init_memblock memblock_free(void *ptr, size_t size)
 	if (ptr)
 		memblock_phys_free(__pa(ptr), size);
 }
+#ifdef CONFIG_ARCH_KEEP_MEMBLOCK
+EXPORT_SYMBOL_GPL(memblock_free);
+#endif
 
 /**
  * memblock_phys_free - free boot memory block
-- 
2.25.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] memblock: export memblock_free() to free reserved memory.
  2024-06-25 12:16 [PATCH v2] memblock: export memblock_free() to free reserved memory Guanshun Liu
@ 2024-06-25 15:53 ` Christoph Hellwig
  2024-06-26  5:02 ` Mike Rapoport
  1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2024-06-25 15:53 UTC (permalink / raw)
  To: Guanshun Liu; +Cc: rppt, akpm, linux-mm, linux-kernel

On Tue, Jun 25, 2024 at 08:16:52PM +0800, Guanshun Liu wrote:
> On architectures that support the preservation of memblock metadata
> after __init, allow drivers to call memblock_free() to free a
> reservation configured in dts. This is a hack to support the
> freeing of bootsplash reservations passed to Linux by the bootloader.

What driver?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] memblock: export memblock_free() to free reserved memory.
  2024-06-25 12:16 [PATCH v2] memblock: export memblock_free() to free reserved memory Guanshun Liu
  2024-06-25 15:53 ` Christoph Hellwig
@ 2024-06-26  5:02 ` Mike Rapoport
  2024-07-01  8:31   ` liangxi Liu
                     ` (2 more replies)
  1 sibling, 3 replies; 6+ messages in thread
From: Mike Rapoport @ 2024-06-26  5:02 UTC (permalink / raw)
  To: Guanshun Liu; +Cc: akpm, linux-mm, linux-kernel

On Tue, Jun 25, 2024 at 08:16:52PM +0800, Guanshun Liu wrote:
> On architectures that support the preservation of memblock metadata
> after __init, allow drivers to call memblock_free() to free a
> reservation configured in dts. This is a hack to support the

"This is a hack" implies that it's not a proper solution, right?

And anyway, memblock_free() will not actually free the memory after __init.

> freeing of bootsplash reservations passed to Linux by the bootloader.
> 
> Signed-off-by: Guanshun Liu <lgs156412@gmail.com>
> ---
>  mm/memblock.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 6d18485571b4..20e7f81fc076 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -848,6 +848,9 @@ void __init_memblock memblock_free(void *ptr, size_t size)
>  	if (ptr)
>  		memblock_phys_free(__pa(ptr), size);
>  }
> +#ifdef CONFIG_ARCH_KEEP_MEMBLOCK
> +EXPORT_SYMBOL_GPL(memblock_free);
> +#endif
>  
>  /**
>   * memblock_phys_free - free boot memory block
> -- 
> 2.25.1
> 

-- 
Sincerely yours,
Mike.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] memblock: export memblock_free() to free reserved memory.
  2024-06-26  5:02 ` Mike Rapoport
@ 2024-07-01  8:31   ` liangxi Liu
  2024-07-01  8:46   ` liangxi Liu
  2024-07-12  8:04   ` liangxi Liu
  2 siblings, 0 replies; 6+ messages in thread
From: liangxi Liu @ 2024-07-01  8:31 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: akpm, liangxi Liu, linux-kernel, linux-mm

[-- Attachment #1: Type: text/plain, Size: 1518 bytes --]

Yes. we have a reserved memory used for display the image, which needs to
be deleted from memblock.reserved list(memblock_free
()) after display and then released into the buddy system(free_reserved_page
()). Should I use memblock_free() or another API?

On Wed, Jun 26, 2024 at 1:05 PM Mike Rapoport <rppt@kernel.org> wrote:

> On Tue, Jun 25, 2024 at 08:16:52PM +0800, Guanshun Liu wrote:
> > On architectures that support the preservation of memblock metadata
> > after __init, allow drivers to call memblock_free() to free a
> > reservation configured in dts. This is a hack to support the
>
> "This is a hack" implies that it's not a proper solution, right?
>
> And anyway, memblock_free() will not actually free the memory after __init.
>
> > freeing of bootsplash reservations passed to Linux by the bootloader.
> >
> > Signed-off-by: Guanshun Liu <lgs156412@gmail.com>
> > ---
> >  mm/memblock.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/mm/memblock.c b/mm/memblock.c
> > index 6d18485571b4..20e7f81fc076 100644
> > --- a/mm/memblock.c
> > +++ b/mm/memblock.c
> > @@ -848,6 +848,9 @@ void __init_memblock memblock_free(void *ptr, size_t
> size)
> >       if (ptr)
> >               memblock_phys_free(__pa(ptr), size);
> >  }
> > +#ifdef CONFIG_ARCH_KEEP_MEMBLOCK
> > +EXPORT_SYMBOL_GPL(memblock_free);
> > +#endif
> >
> >  /**
> >   * memblock_phys_free - free boot memory block
> > --
> > 2.25.1
> >
>
> --
> Sincerely yours,
> Mike.
>

[-- Attachment #2: Type: text/html, Size: 2275 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] memblock: export memblock_free() to free reserved memory.
  2024-06-26  5:02 ` Mike Rapoport
  2024-07-01  8:31   ` liangxi Liu
@ 2024-07-01  8:46   ` liangxi Liu
  2024-07-12  8:04   ` liangxi Liu
  2 siblings, 0 replies; 6+ messages in thread
From: liangxi Liu @ 2024-07-01  8:46 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: akpm, liangxi Liu, linux-kernel, linux-mm

Yes. we have a reserved memory used for display the image, which needs
to be deleted from memblock.reserved list(memblock_free
()) after display and then released into the buddy system(free_reserved_page
()). Should I use memblock_free() or another API?


Mike Rapoport <rppt@kernel.org> 于2024年6月26日周三 13:05写道:
>
> On Tue, Jun 25, 2024 at 08:16:52PM +0800, Guanshun Liu wrote:
> > On architectures that support the preservation of memblock metadata
> > after __init, allow drivers to call memblock_free() to free a
> > reservation configured in dts. This is a hack to support the
>
> "This is a hack" implies that it's not a proper solution, right?
>
> And anyway, memblock_free() will not actually free the memory after __init.
>
> > freeing of bootsplash reservations passed to Linux by the bootloader.
> >
> > Signed-off-by: Guanshun Liu <lgs156412@gmail.com>
> > ---
> >  mm/memblock.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/mm/memblock.c b/mm/memblock.c
> > index 6d18485571b4..20e7f81fc076 100644
> > --- a/mm/memblock.c
> > +++ b/mm/memblock.c
> > @@ -848,6 +848,9 @@ void __init_memblock memblock_free(void *ptr, size_t size)
> >       if (ptr)
> >               memblock_phys_free(__pa(ptr), size);
> >  }
> > +#ifdef CONFIG_ARCH_KEEP_MEMBLOCK
> > +EXPORT_SYMBOL_GPL(memblock_free);
> > +#endif
> >
> >  /**
> >   * memblock_phys_free - free boot memory block
> > --
> > 2.25.1
> >
>
> --
> Sincerely yours,
> Mike.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] memblock: export memblock_free() to free reserved memory.
  2024-06-26  5:02 ` Mike Rapoport
  2024-07-01  8:31   ` liangxi Liu
  2024-07-01  8:46   ` liangxi Liu
@ 2024-07-12  8:04   ` liangxi Liu
  2 siblings, 0 replies; 6+ messages in thread
From: liangxi Liu @ 2024-07-12  8:04 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: akpm, liangxi Liu, linux-kernel, linux-mm

Yes. we have a reserved memory used for display the image, which needs
to be deleted from memblock.reserved list(memblock_free
()) after display and then released into the buddy system(free_reserved_page
()). Should I use memblock_free() or another API?

Mike Rapoport <rppt@kernel.org> 于2024年6月26日周三 13:05写道:
>
> On Tue, Jun 25, 2024 at 08:16:52PM +0800, Guanshun Liu wrote:
> > On architectures that support the preservation of memblock metadata
> > after __init, allow drivers to call memblock_free() to free a
> > reservation configured in dts. This is a hack to support the
>
> "This is a hack" implies that it's not a proper solution, right?
>
> And anyway, memblock_free() will not actually free the memory after __init.
>
> > freeing of bootsplash reservations passed to Linux by the bootloader.
> >
> > Signed-off-by: Guanshun Liu <lgs156412@gmail.com>
> > ---
> >  mm/memblock.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/mm/memblock.c b/mm/memblock.c
> > index 6d18485571b4..20e7f81fc076 100644
> > --- a/mm/memblock.c
> > +++ b/mm/memblock.c
> > @@ -848,6 +848,9 @@ void __init_memblock memblock_free(void *ptr, size_t size)
> >       if (ptr)
> >               memblock_phys_free(__pa(ptr), size);
> >  }
> > +#ifdef CONFIG_ARCH_KEEP_MEMBLOCK
> > +EXPORT_SYMBOL_GPL(memblock_free);
> > +#endif
> >
> >  /**
> >   * memblock_phys_free - free boot memory block
> > --
> > 2.25.1
> >
>
> --
> Sincerely yours,
> Mike.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-07-12  8:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 12:16 [PATCH v2] memblock: export memblock_free() to free reserved memory Guanshun Liu
2024-06-25 15:53 ` Christoph Hellwig
2024-06-26  5:02 ` Mike Rapoport
2024-07-01  8:31   ` liangxi Liu
2024-07-01  8:46   ` liangxi Liu
2024-07-12  8:04   ` liangxi Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox