2021-06-04 07:01:10

by Kefeng Wang

[permalink] [raw]
Subject: [PATCH v2 00/15] init_mm: cleanup ARCH's text/data/brk setup code

Add setup_initial_init_mm() helper, then use it
to cleanup the text, data and brk setup code.

v2:
- change argument from "char *" to "void *" setup_initial_init_mm()
suggested by Geert Uytterhoeven
- use NULL instead of (void *)0 on h8300 and m68k
- collect ACKs

Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Kefeng Wang (15):
mm: add setup_initial_init_mm() helper
arc: convert to setup_initial_init_mm()
arm: convert to setup_initial_init_mm()
arm64: convert to setup_initial_init_mm()
csky: convert to setup_initial_init_mm()
h8300: convert to setup_initial_init_mm()
m68k: convert to setup_initial_init_mm()
nds32: convert to setup_initial_init_mm()
nios2: convert to setup_initial_init_mm()
openrisc: convert to setup_initial_init_mm()
powerpc: convert to setup_initial_init_mm()
riscv: convert to setup_initial_init_mm()
s390: convert to setup_initial_init_mm()
sh: convert to setup_initial_init_mm()
x86: convert to setup_initial_init_mm()

arch/arc/mm/init.c | 5 +----
arch/arm/kernel/setup.c | 5 +----
arch/arm64/kernel/setup.c | 5 +----
arch/csky/kernel/setup.c | 5 +----
arch/h8300/kernel/setup.c | 5 +----
arch/m68k/kernel/setup_mm.c | 5 +----
arch/m68k/kernel/setup_no.c | 5 +----
arch/nds32/kernel/setup.c | 5 +----
arch/nios2/kernel/setup.c | 5 +----
arch/openrisc/kernel/setup.c | 5 +----
arch/powerpc/kernel/setup-common.c | 5 +----
arch/riscv/kernel/setup.c | 5 +----
arch/s390/kernel/setup.c | 5 +----
arch/sh/kernel/setup.c | 5 +----
arch/x86/kernel/setup.c | 5 +----
include/linux/mm_types.h | 8 ++++++++
16 files changed, 23 insertions(+), 60 deletions(-)

--
2.26.2


2021-06-04 07:01:17

by Kefeng Wang

[permalink] [raw]
Subject: [PATCH v2 03/15] arm: convert to setup_initial_init_mm()

Use setup_initial_init_mm() helper to simplify code.

Cc: Russell King <[email protected]>
Cc: [email protected]
Signed-off-by: Kefeng Wang <[email protected]>
---
arch/arm/kernel/setup.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1a5edf562e85..81de1bf07ba6 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1114,10 +1114,7 @@ void __init setup_arch(char **cmdline_p)
if (mdesc->reboot_mode != REBOOT_HARD)
reboot_mode = mdesc->reboot_mode;

- init_mm.start_code = (unsigned long) _text;
- init_mm.end_code = (unsigned long) _etext;
- init_mm.end_data = (unsigned long) _edata;
- init_mm.brk = (unsigned long) _end;
+ setup_initial_init_mm(_text, _etext, _edata, _end);

/* populate cmd_line too for later use, preserving boot_command_line */
strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
--
2.26.2

2021-06-04 07:02:09

by Kefeng Wang

[permalink] [raw]
Subject: [PATCH v2 15/15] x86: convert to setup_initial_init_mm()

Use setup_initial_init_mm() helper to simplify code.

Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: [email protected]
Signed-off-by: Kefeng Wang <[email protected]>
---
arch/x86/kernel/setup.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 72920af0b3c0..2be957ab7f8c 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -868,10 +868,7 @@ void __init setup_arch(char **cmdline_p)

if (!boot_params.hdr.root_flags)
root_mountflags &= ~MS_RDONLY;
- init_mm.start_code = (unsigned long) _text;
- init_mm.end_code = (unsigned long) _etext;
- init_mm.end_data = (unsigned long) _edata;
- init_mm.brk = _brk_end;
+ setup_initial_init_mm(_text, _etext, _edata, _brk_end);

code_resource.start = __pa_symbol(_text);
code_resource.end = __pa_symbol(_etext)-1;
--
2.26.2

2021-06-04 07:02:22

by Kefeng Wang

[permalink] [raw]
Subject: [PATCH v2 12/15] riscv: convert to setup_initial_init_mm()

Use setup_initial_init_mm() helper to simplify code.

Cc: Paul Walmsley <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: [email protected]
Signed-off-by: Kefeng Wang <[email protected]>
---
arch/riscv/kernel/setup.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 03901d3a8b02..52396874f859 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -264,10 +264,7 @@ static void __init parse_dtb(void)
void __init setup_arch(char **cmdline_p)
{
parse_dtb();
- init_mm.start_code = (unsigned long) _stext;
- init_mm.end_code = (unsigned long) _etext;
- init_mm.end_data = (unsigned long) _edata;
- init_mm.brk = (unsigned long) _end;
+ setup_initial_init_mm(_stext, _etext, _edata, _end);

*cmdline_p = boot_command_line;

--
2.26.2

2021-06-06 21:32:32

by Mike Rapoport

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] init_mm: cleanup ARCH's text/data/brk setup code

Hello Kefeng,

On Fri, Jun 04, 2021 at 03:06:18PM +0800, Kefeng Wang wrote:
> Add setup_initial_init_mm() helper, then use it
> to cleanup the text, data and brk setup code.
>
> v2:
> - change argument from "char *" to "void *" setup_initial_init_mm()
> suggested by Geert Uytterhoeven
> - use NULL instead of (void *)0 on h8300 and m68k
> - collect ACKs
>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Kefeng Wang (15):
> mm: add setup_initial_init_mm() helper
> arc: convert to setup_initial_init_mm()
> arm: convert to setup_initial_init_mm()
> arm64: convert to setup_initial_init_mm()
> csky: convert to setup_initial_init_mm()
> h8300: convert to setup_initial_init_mm()
> m68k: convert to setup_initial_init_mm()
> nds32: convert to setup_initial_init_mm()
> nios2: convert to setup_initial_init_mm()
> openrisc: convert to setup_initial_init_mm()
> powerpc: convert to setup_initial_init_mm()
> riscv: convert to setup_initial_init_mm()
> s390: convert to setup_initial_init_mm()
> sh: convert to setup_initial_init_mm()
> x86: convert to setup_initial_init_mm()

I might be missing something, but AFAIU the init_mm.start_code and other
fields are not used really early so the new setup_initial_init_mm()
function can be called in the generic code outside setup_arch(), e.g in
mm_init().

> arch/arc/mm/init.c | 5 +----
> arch/arm/kernel/setup.c | 5 +----
> arch/arm64/kernel/setup.c | 5 +----
> arch/csky/kernel/setup.c | 5 +----
> arch/h8300/kernel/setup.c | 5 +----
> arch/m68k/kernel/setup_mm.c | 5 +----
> arch/m68k/kernel/setup_no.c | 5 +----
> arch/nds32/kernel/setup.c | 5 +----
> arch/nios2/kernel/setup.c | 5 +----
> arch/openrisc/kernel/setup.c | 5 +----
> arch/powerpc/kernel/setup-common.c | 5 +----
> arch/riscv/kernel/setup.c | 5 +----
> arch/s390/kernel/setup.c | 5 +----
> arch/sh/kernel/setup.c | 5 +----
> arch/x86/kernel/setup.c | 5 +----
> include/linux/mm_types.h | 8 ++++++++
> 16 files changed, 23 insertions(+), 60 deletions(-)
>
> --
> 2.26.2
>
>
> _______________________________________________
> linux-riscv mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-riscv

--
Sincerely yours,
Mike.

2021-06-07 00:59:19

by Kefeng Wang

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] init_mm: cleanup ARCH's text/data/brk setup code


On 2021/6/7 5:29, Mike Rapoport wrote:
> Hello Kefeng,
>
> On Fri, Jun 04, 2021 at 03:06:18PM +0800, Kefeng Wang wrote:
>> Add setup_initial_init_mm() helper, then use it
>> to cleanup the text, data and brk setup code.
>>
>> v2:
>> - change argument from "char *" to "void *" setup_initial_init_mm()
>> suggested by Geert Uytterhoeven
>> - use NULL instead of (void *)0 on h8300 and m68k
>> - collect ACKs
>>
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Kefeng Wang (15):
>> mm: add setup_initial_init_mm() helper
>> arc: convert to setup_initial_init_mm()
>> arm: convert to setup_initial_init_mm()
>> arm64: convert to setup_initial_init_mm()
>> csky: convert to setup_initial_init_mm()
>> h8300: convert to setup_initial_init_mm()
>> m68k: convert to setup_initial_init_mm()
>> nds32: convert to setup_initial_init_mm()
>> nios2: convert to setup_initial_init_mm()
>> openrisc: convert to setup_initial_init_mm()
>> powerpc: convert to setup_initial_init_mm()
>> riscv: convert to setup_initial_init_mm()
>> s390: convert to setup_initial_init_mm()
>> sh: convert to setup_initial_init_mm()
>> x86: convert to setup_initial_init_mm()
> I might be missing something, but AFAIU the init_mm.start_code and other
> fields are not used really early so the new setup_initial_init_mm()
> function can be called in the generic code outside setup_arch(), e.g in
> mm_init().

Hi Mike, each architecture has their own value, not the same, eg m68K and

h8300, also the name of the text/code/brk is different in some arch, so
I keep

unchanged.

>
>> arch/arc/mm/init.c | 5 +----
>> arch/arm/kernel/setup.c | 5 +----
>> arch/arm64/kernel/setup.c | 5 +----
>> arch/csky/kernel/setup.c | 5 +----
>> arch/h8300/kernel/setup.c | 5 +----
>> arch/m68k/kernel/setup_mm.c | 5 +----
>> arch/m68k/kernel/setup_no.c | 5 +----
>> arch/nds32/kernel/setup.c | 5 +----
>> arch/nios2/kernel/setup.c | 5 +----
>> arch/openrisc/kernel/setup.c | 5 +----
>> arch/powerpc/kernel/setup-common.c | 5 +----
>> arch/riscv/kernel/setup.c | 5 +----
>> arch/s390/kernel/setup.c | 5 +----
>> arch/sh/kernel/setup.c | 5 +----
>> arch/x86/kernel/setup.c | 5 +----
>> include/linux/mm_types.h | 8 ++++++++
>> 16 files changed, 23 insertions(+), 60 deletions(-)
>>
>> --
>> 2.26.2
>>
>>
>> _______________________________________________
>> linux-riscv mailing list
>> [email protected]
>> http://lists.infradead.org/mailman/listinfo/linux-riscv

2021-06-07 05:50:25

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] init_mm: cleanup ARCH's text/data/brk setup code

Hi Kefeng,

Le 07/06/2021 à 02:55, Kefeng Wang a écrit :
>
> On 2021/6/7 5:29, Mike Rapoport wrote:
>> Hello Kefeng,
>>
>> On Fri, Jun 04, 2021 at 03:06:18PM +0800, Kefeng Wang wrote:
>>> Add setup_initial_init_mm() helper, then use it
>>> to cleanup the text, data and brk setup code.
>>>
>>> v2:
>>> - change argument from "char *" to "void *" setup_initial_init_mm()
>>>    suggested by Geert Uytterhoeven
>>> - use NULL instead of (void *)0 on h8300 and m68k
>>> - collect ACKs
>>>
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Kefeng Wang (15):
>>>    mm: add setup_initial_init_mm() helper
>>>    arc: convert to setup_initial_init_mm()
>>>    arm: convert to setup_initial_init_mm()
>>>    arm64: convert to setup_initial_init_mm()
>>>    csky: convert to setup_initial_init_mm()
>>>    h8300: convert to setup_initial_init_mm()
>>>    m68k: convert to setup_initial_init_mm()
>>>    nds32: convert to setup_initial_init_mm()
>>>    nios2: convert to setup_initial_init_mm()
>>>    openrisc: convert to setup_initial_init_mm()
>>>    powerpc: convert to setup_initial_init_mm()
>>>    riscv: convert to setup_initial_init_mm()
>>>    s390: convert to setup_initial_init_mm()
>>>    sh: convert to setup_initial_init_mm()
>>>    x86: convert to setup_initial_init_mm()
>> I might be missing something, but AFAIU the init_mm.start_code and other
>> fields are not used really early so the new setup_initial_init_mm()
>> function can be called in the generic code outside setup_arch(), e.g in
>> mm_init().
>
> Hi Mike, each architecture has their own value, not the same, eg m68K and
>
> h8300, also the name of the text/code/brk is different in some arch, so I keep
>
> unchanged.

What you could do is to define a __weak function that architectures can override and call that
function from mm_init() as suggested by Mike,

Something like:

void __weak setup_initial_init_mm(void)
{
init_mm.start_code = (unsigned long)_stext;
init_mm.end_code = (unsigned long)_etext;
init_mm.end_data = (unsigned long)_edata;
init_mm.brk = (unsigned long)_end;
}

Then only the few architecture that are different would override it.

I see a few archictectures are usigne PAGE_OFFSET to set .start_code, but it is likely that this is
equivalent to _stext.

Christophe

2021-06-07 08:31:58

by Kefeng Wang

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] init_mm: cleanup ARCH's text/data/brk setup code


On 2021/6/7 13:48, Christophe Leroy wrote:
> Hi Kefeng,
>
> Le 07/06/2021 à 02:55, Kefeng Wang a écrit :
>>
>> On 2021/6/7 5:29, Mike Rapoport wrote:
>>> Hello Kefeng,
>>>
>>> On Fri, Jun 04, 2021 at 03:06:18PM +0800, Kefeng Wang wrote:
>>>> Add setup_initial_init_mm() helper, then use it
>>>> to cleanup the text, data and brk setup code.
>>>>
>>>> v2:
>>>> - change argument from "char *" to "void *" setup_initial_init_mm()
>>>>    suggested by Geert Uytterhoeven
>>>> - use NULL instead of (void *)0 on h8300 and m68k
>>>> - collect ACKs
>>>>
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> Kefeng Wang (15):
>>>>    mm: add setup_initial_init_mm() helper
>>>>    arc: convert to setup_initial_init_mm()
>>>>    arm: convert to setup_initial_init_mm()
>>>>    arm64: convert to setup_initial_init_mm()
>>>>    csky: convert to setup_initial_init_mm()
>>>>    h8300: convert to setup_initial_init_mm()
>>>>    m68k: convert to setup_initial_init_mm()
>>>>    nds32: convert to setup_initial_init_mm()
>>>>    nios2: convert to setup_initial_init_mm()
>>>>    openrisc: convert to setup_initial_init_mm()
>>>>    powerpc: convert to setup_initial_init_mm()
>>>>    riscv: convert to setup_initial_init_mm()
>>>>    s390: convert to setup_initial_init_mm()
>>>>    sh: convert to setup_initial_init_mm()
>>>>    x86: convert to setup_initial_init_mm()
>>> I might be missing something, but AFAIU the init_mm.start_code and
>>> other
>>> fields are not used really early so the new setup_initial_init_mm()
>>> function can be called in the generic code outside setup_arch(), e.g in
>>> mm_init().
>>
>> Hi Mike, each architecture has their own value, not the same, eg m68K
>> and
>>
>> h8300, also the name of the text/code/brk is different in some arch,
>> so I keep
>>
>> unchanged.
>
> What you could do is to define a __weak function that architectures
> can override and call that function from mm_init() as suggested by Mike,
>
> Something like:
>
> void __weak setup_initial_init_mm(void)
> {
>     init_mm.start_code = (unsigned long)_stext;
>     init_mm.end_code = (unsigned long)_etext;
>     init_mm.end_data = (unsigned long)_edata;
>     init_mm.brk = (unsigned long)_end;
> }
>
> Then only the few architecture that are different would override it.
>
> I see a few archictectures are usigne PAGE_OFFSET to set .start_code,
> but it is likely that this is equivalent to _stext.


Yes,  the __weak function is option, but the change is only covered 14
archs, there are 7 other archs(alpha  hexagon  ia64

microblaze  mips sparc  um xtensa)without related setup code. Also like
x86, it has own brk , maybe there are some

other different in some arch, so I think let's keep unchanged for now, 
thanks.

>
> Christophe
> .
>

2021-06-07 09:30:13

by Russell King (Oracle)

[permalink] [raw]
Subject: Re: [PATCH v2 03/15] arm: convert to setup_initial_init_mm()

On Fri, Jun 04, 2021 at 03:06:21PM +0800, Kefeng Wang wrote:
> Use setup_initial_init_mm() helper to simplify code.
>
> Cc: Russell King <[email protected]>
> Cc: [email protected]
> Signed-off-by: Kefeng Wang <[email protected]>

Acked-by: Russell King (Oracle) <[email protected]>

Thanks.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

2021-06-07 09:34:57

by Russell King (Oracle)

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] init_mm: cleanup ARCH's text/data/brk setup code

On Mon, Jun 07, 2021 at 07:48:54AM +0200, Christophe Leroy wrote:
> Hi Kefeng,
>
> What you could do is to define a __weak function that architectures can
> override and call that function from mm_init() as suggested by Mike,

The problem with weak functions is that they bloat the kernel. Each
time a weak function is overriden, it becomes dead unreachable code
within the kernel image.

At some point we're probabily going to have to enable -ffunction-sections
to (hopefully) allow the dead code to be discarded.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

2021-06-08 00:28:37

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH v2 15/15] x86: convert to setup_initial_init_mm()

On Fri, 4 Jun 2021 15:06:33 +0800 Kefeng Wang <[email protected]> wrote:

> Use setup_initial_init_mm() helper to simplify code.
>
> ...
>
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -868,10 +868,7 @@ void __init setup_arch(char **cmdline_p)
>
> if (!boot_params.hdr.root_flags)
> root_mountflags &= ~MS_RDONLY;
> - init_mm.start_code = (unsigned long) _text;
> - init_mm.end_code = (unsigned long) _etext;
> - init_mm.end_data = (unsigned long) _edata;
> - init_mm.brk = _brk_end;
> + setup_initial_init_mm(_text, _etext, _edata, _brk_end);
>
> code_resource.start = __pa_symbol(_text);
> code_resource.end = __pa_symbol(_etext)-1;

arch/x86/kernel/setup.c:873:47: warning: passing argument 4 of 'setup_initial_init_mm' makes pointer from integer without a cast [-Wint-conversion]
873 | setup_initial_init_mm(_text, _etext, _edata, _brk_end);
| ^~~~~~~~
| |
| long unsigned int
In file included from ./include/linux/pid_namespace.h:7,
from ./include/linux/ptrace.h:10,
from ./include/linux/elfcore.h:11,
from ./include/linux/crash_core.h:6,
from ./include/linux/kexec.h:18,
from ./include/linux/crash_dump.h:5,
from arch/x86/kernel/setup.c:9:
./include/linux/mm.h:248:29: note: expected 'void *' but argument is of type 'long unsigned int'
248 | void *end_data, void *brk);
| ~~~~~~^~~


afaict the other architectures will warn this way, not sure.

Please check all that, refresh ,retest and resend?

2021-06-08 01:43:09

by Kefeng Wang

[permalink] [raw]
Subject: Re: [PATCH v2 15/15] x86: convert to setup_initial_init_mm()


On 2021/6/8 8:26, Andrew Morton wrote:
> On Fri, 4 Jun 2021 15:06:33 +0800 Kefeng Wang <[email protected]> wrote:
>
>> Use setup_initial_init_mm() helper to simplify code.
>>
>> ...
>>
>> --- a/arch/x86/kernel/setup.c
>> +++ b/arch/x86/kernel/setup.c
>> @@ -868,10 +868,7 @@ void __init setup_arch(char **cmdline_p)
>>
>> if (!boot_params.hdr.root_flags)
>> root_mountflags &= ~MS_RDONLY;
>> - init_mm.start_code = (unsigned long) _text;
>> - init_mm.end_code = (unsigned long) _etext;
>> - init_mm.end_data = (unsigned long) _edata;
>> - init_mm.brk = _brk_end;
>> + setup_initial_init_mm(_text, _etext, _edata, _brk_end);
>>
>> code_resource.start = __pa_symbol(_text);
>> code_resource.end = __pa_symbol(_etext)-1;
> arch/x86/kernel/setup.c:873:47: warning: passing argument 4 of 'setup_initial_init_mm' makes pointer from integer without a cast [-Wint-conversion]
> 873 | setup_initial_init_mm(_text, _etext, _edata, _brk_end);
> | ^~~~~~~~
> | |
> | long unsigned int
> In file included from ./include/linux/pid_namespace.h:7,
> from ./include/linux/ptrace.h:10,
> from ./include/linux/elfcore.h:11,
> from ./include/linux/crash_core.h:6,
> from ./include/linux/kexec.h:18,
> from ./include/linux/crash_dump.h:5,
> from arch/x86/kernel/setup.c:9:
> ./include/linux/mm.h:248:29: note: expected 'void *' but argument is of type 'long unsigned int'
> 248 | void *end_data, void *brk);
> | ~~~~~~^~~
>
>
> afaict the other architectures will warn this way, not sure.

I check all archs again, the x86/m68k/powerpc/h8300 has use some value
which is not pointer ,

other are changed, but forget this one.  I do compile, but I don't know
why I missed it, sorry about

this.


>
> Please check all that, refresh ,retest and resend?
> .
>

2021-06-12 04:00:39

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH v2 12/15] riscv: convert to setup_initial_init_mm()

On Fri, 04 Jun 2021 00:06:30 PDT (-0700), [email protected] wrote:
> Use setup_initial_init_mm() helper to simplify code.
>
> Cc: Paul Walmsley <[email protected]>
> Cc: Palmer Dabbelt <[email protected]>
> Cc: [email protected]
> Signed-off-by: Kefeng Wang <[email protected]>
> ---
> arch/riscv/kernel/setup.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index 03901d3a8b02..52396874f859 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -264,10 +264,7 @@ static void __init parse_dtb(void)
> void __init setup_arch(char **cmdline_p)
> {
> parse_dtb();
> - init_mm.start_code = (unsigned long) _stext;
> - init_mm.end_code = (unsigned long) _etext;
> - init_mm.end_data = (unsigned long) _edata;
> - init_mm.brk = (unsigned long) _end;
> + setup_initial_init_mm(_stext, _etext, _edata, _end);
>
> *cmdline_p = boot_command_line;

Acked-by: Palmer Dabbelt <[email protected]>