* [PATCH v1] csky: use free_initmem_default() in free_initmem()
@ 2021-01-26 18:14 David Hildenbrand
2021-01-26 18:26 ` Mike Rapoport
0 siblings, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2021-01-26 18:14 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linux-csky, David Hildenbrand, Andrew Morton, Guo Ren,
Mike Rapoport, Oscar Salvador, Michal Hocko, Wei Yang
The existing code is essentially
free_initmem_default()->free_reserved_area() without poisoning.
Note that existing code missed to update the managed page count of the
zone.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
Not compile tested as documentation on how to get
https://gitlab.com/c-sky/buildroot
running, especially with a custom kernel, is a bit sparse.
---
arch/csky/mm/init.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/arch/csky/mm/init.c b/arch/csky/mm/init.c
index 81e4e5e78f38..894050a8ce09 100644
--- a/arch/csky/mm/init.c
+++ b/arch/csky/mm/init.c
@@ -110,24 +110,9 @@ void __init mem_init(void)
mem_init_print_info(NULL);
}
-extern char __init_begin[], __init_end[];
-
void free_initmem(void)
{
- unsigned long addr;
-
- addr = (unsigned long) &__init_begin;
-
- while (addr < (unsigned long) &__init_end) {
- ClearPageReserved(virt_to_page(addr));
- init_page_count(virt_to_page(addr));
- free_page(addr);
- totalram_pages_inc();
- addr += PAGE_SIZE;
- }
-
- pr_info("Freeing unused kernel memory: %dk freed\n",
- ((unsigned int)&__init_end - (unsigned int)&__init_begin) >> 10);
+ free_initmem_default(-1);
}
void pgd_init(unsigned long *p)
--
2.29.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1] csky: use free_initmem_default() in free_initmem()
2021-01-26 18:14 [PATCH v1] csky: use free_initmem_default() in free_initmem() David Hildenbrand
@ 2021-01-26 18:26 ` Mike Rapoport
2021-01-27 7:52 ` Guo Ren
0 siblings, 1 reply; 5+ messages in thread
From: Mike Rapoport @ 2021-01-26 18:26 UTC (permalink / raw)
To: David Hildenbrand
Cc: linux-kernel, linux-mm, linux-csky, Andrew Morton, Guo Ren,
Oscar Salvador, Michal Hocko, Wei Yang
On Tue, Jan 26, 2021 at 07:14:20PM +0100, David Hildenbrand wrote:
> The existing code is essentially
> free_initmem_default()->free_reserved_area() without poisoning.
>
> Note that existing code missed to update the managed page count of the
> zone.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Guo Ren <guoren@kernel.org>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>
> Not compile tested as documentation on how to get
> https://gitlab.com/c-sky/buildroot
> running, especially with a custom kernel, is a bit sparse.
You can pick a cross-compiler from here:
https://mirrors.edge.kernel.org/pub/tools/crosstool/
> ---
> arch/csky/mm/init.c | 17 +----------------
> 1 file changed, 1 insertion(+), 16 deletions(-)
>
> diff --git a/arch/csky/mm/init.c b/arch/csky/mm/init.c
> index 81e4e5e78f38..894050a8ce09 100644
> --- a/arch/csky/mm/init.c
> +++ b/arch/csky/mm/init.c
> @@ -110,24 +110,9 @@ void __init mem_init(void)
> mem_init_print_info(NULL);
> }
>
> -extern char __init_begin[], __init_end[];
> -
> void free_initmem(void)
> {
> - unsigned long addr;
> -
> - addr = (unsigned long) &__init_begin;
> -
> - while (addr < (unsigned long) &__init_end) {
> - ClearPageReserved(virt_to_page(addr));
> - init_page_count(virt_to_page(addr));
> - free_page(addr);
> - totalram_pages_inc();
> - addr += PAGE_SIZE;
> - }
> -
> - pr_info("Freeing unused kernel memory: %dk freed\n",
> - ((unsigned int)&__init_end - (unsigned int)&__init_begin) >> 10);
> + free_initmem_default(-1);
> }
>
> void pgd_init(unsigned long *p)
> --
> 2.29.2
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] csky: use free_initmem_default() in free_initmem()
2021-01-26 18:26 ` Mike Rapoport
@ 2021-01-27 7:52 ` Guo Ren
2021-01-27 8:49 ` David Hildenbrand
0 siblings, 1 reply; 5+ messages in thread
From: Guo Ren @ 2021-01-27 7:52 UTC (permalink / raw)
To: Mike Rapoport
Cc: David Hildenbrand, Linux Kernel Mailing List, Linux-MM,
linux-csky, Andrew Morton, Oscar Salvador, Michal Hocko,
Wei Yang
Thx Mike,
It's under test:
https://gitlab.com/c-sky/buildroot/-/pipelines/247353584
kernel:
https://github.com/c-sky/csky-linux/commit/9d986b01feb991ded3fb8c1f8153a0c80ea84b9c
On Wed, Jan 27, 2021 at 2:26 AM Mike Rapoport <rppt@kernel.org> wrote:
>
> On Tue, Jan 26, 2021 at 07:14:20PM +0100, David Hildenbrand wrote:
> > The existing code is essentially
> > free_initmem_default()->free_reserved_area() without poisoning.
> >
> > Note that existing code missed to update the managed page count of the
> > zone.
> >
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Guo Ren <guoren@kernel.org>
> > Cc: Mike Rapoport <rppt@kernel.org>
> > Cc: Oscar Salvador <osalvador@suse.de>
> > Cc: Michal Hocko <mhocko@kernel.org>
> > Cc: Wei Yang <richard.weiyang@linux.alibaba.com>
> > Signed-off-by: David Hildenbrand <david@redhat.com>
> > ---
> >
> > Not compile tested as documentation on how to get
> > https://gitlab.com/c-sky/buildroot
> > running, especially with a custom kernel, is a bit sparse.
>
> You can pick a cross-compiler from here:
>
> https://mirrors.edge.kernel.org/pub/tools/crosstool/
>
> > ---
> > arch/csky/mm/init.c | 17 +----------------
> > 1 file changed, 1 insertion(+), 16 deletions(-)
> >
> > diff --git a/arch/csky/mm/init.c b/arch/csky/mm/init.c
> > index 81e4e5e78f38..894050a8ce09 100644
> > --- a/arch/csky/mm/init.c
> > +++ b/arch/csky/mm/init.c
> > @@ -110,24 +110,9 @@ void __init mem_init(void)
> > mem_init_print_info(NULL);
> > }
> >
> > -extern char __init_begin[], __init_end[];
> > -
> > void free_initmem(void)
> > {
> > - unsigned long addr;
> > -
> > - addr = (unsigned long) &__init_begin;
> > -
> > - while (addr < (unsigned long) &__init_end) {
> > - ClearPageReserved(virt_to_page(addr));
> > - init_page_count(virt_to_page(addr));
> > - free_page(addr);
> > - totalram_pages_inc();
> > - addr += PAGE_SIZE;
> > - }
> > -
> > - pr_info("Freeing unused kernel memory: %dk freed\n",
> > - ((unsigned int)&__init_end - (unsigned int)&__init_begin) >> 10);
> > + free_initmem_default(-1);
> > }
> >
> > void pgd_init(unsigned long *p)
> > --
> > 2.29.2
> >
>
> --
> Sincerely yours,
> Mike.
--
Best Regards
Guo Ren
ML: https://lore.kernel.org/linux-csky/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] csky: use free_initmem_default() in free_initmem()
2021-01-27 7:52 ` Guo Ren
@ 2021-01-27 8:49 ` David Hildenbrand
2021-01-27 9:06 ` Guo Ren
0 siblings, 1 reply; 5+ messages in thread
From: David Hildenbrand @ 2021-01-27 8:49 UTC (permalink / raw)
To: Guo Ren, Mike Rapoport
Cc: Linux Kernel Mailing List, Linux-MM, linux-csky, Andrew Morton,
Oscar Salvador, Michal Hocko, Wei Yang
On 27.01.21 08:52, Guo Ren wrote:
> Thx Mike,
>
Thanks for triggering a build/test! I'd be curious if there is an easy
way to trigger this myself (I assume, fork csky buildroot on gitlab,
reroute CSKY kernel repo, adjust CSKY_LINUX_NEXT_VERSION); if so, it
would be worth documenting - thanks!
Thanks Mike for the valuable links :) For now I was only relying on
cross-compilers as shipped by Fedora, now I can upgrade my cross-build
environment :)
> It's under test:
> https://gitlab.com/c-sky/buildroot/-/pipelines/247353584
>
> kernel:
> https://github.com/c-sky/csky-linux/commit/9d986b01feb991ded3fb8c1f8153a0c80ea84b9c
>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] csky: use free_initmem_default() in free_initmem()
2021-01-27 8:49 ` David Hildenbrand
@ 2021-01-27 9:06 ` Guo Ren
0 siblings, 0 replies; 5+ messages in thread
From: Guo Ren @ 2021-01-27 9:06 UTC (permalink / raw)
To: David Hildenbrand
Cc: Guo Ren, Mike Rapoport, Linux Kernel Mailing List, Linux-MM,
linux-csky, Andrew Morton, Oscar Salvador, Michal Hocko,
Wei Yang
Hi David,
> 在 2021年1月27日,下午4:49,David Hildenbrand <david@redhat.com> 写道:
>
> On 27.01.21 08:52, Guo Ren wrote:
>> Thx Mike,
>
> Thanks for triggering a build/test! I'd be curious if there is an easy way to trigger this myself (I assume, fork csky buildroot on gitlab, reroute CSKY kernel repo, adjust CSKY_LINUX_NEXT_VERSION); if so, it would be worth documenting - thanks!
>
1. You can just simple fork our project, and enable your gitlab share-runner.
2. Modify https://gitlab.com/c-sky/buildroot/-/blob/master/package/csky-arch/csky-arch.mk
Line 28: CSKY_ARCH_SITE = $(call github,c-sky,csky-linux,$(CSKY_ARCH_VERSION)) to your own forked our kernel repo
Line 49: CSKY_LINUX_NEXT_VERSION = f0bbf052ae463b3802f1c7ba36b36da2f54945f2 change the version as you want
You also need to remove some unused entries in .gitlab.yml.
> Thanks Mike for the valuable links :) For now I was only relying on cross-compilers as shipped by Fedora, now I can upgrade my cross-build environment :)
>
>> It's under test:
>> https://gitlab.com/c-sky/buildroot/-/pipelines/247353584
>> kernel:
>> https://github.com/c-sky/csky-linux/commit/9d986b01feb991ded3fb8c1f8153a0c80ea84b9c
>
>
> --
> Thanks,
>
> David / dhildenb
Best Regards
Guo Ren
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-27 9:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 18:14 [PATCH v1] csky: use free_initmem_default() in free_initmem() David Hildenbrand
2021-01-26 18:26 ` Mike Rapoport
2021-01-27 7:52 ` Guo Ren
2021-01-27 8:49 ` David Hildenbrand
2021-01-27 9:06 ` Guo Ren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).