From: bibo mao <maobibo@loongson.cn>
To: Dennis Zhou <dennis@kernel.org>, Huacai Chen <chenhuacai@kernel.org>
Cc: Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@linux.com>,
Andrew Morton <akpm@linux-foundation.org>,
loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, WANG Xuerui <kernel@xen0n.name>
Subject: Re: [PATCH 1/3] mm/percpu: Remove some local variables in pcpu_populate_pte
Date: Fri, 28 Jul 2023 09:13:33 +0800 [thread overview]
Message-ID: <893f8801-b36d-8146-93a6-e97b29826980@loongson.cn> (raw)
In-Reply-To: <ZML414eLkT78bO5G@snowbird>
在 2023/7/28 07:08, Dennis Zhou 写道:
> Hello,
>
> On Wed, Jul 12, 2023 at 11:16:20AM +0800, Bibo Mao wrote:
>> In function pcpu_populate_pte there are already variable defined,
>> it can be reused for later use, here remove duplicated local
>> variables.
>>
>> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
>> ---
>> mm/percpu.c | 24 +++++++++---------------
>> 1 file changed, 9 insertions(+), 15 deletions(-)
>>
>> diff --git a/mm/percpu.c b/mm/percpu.c
>> index 28e07ede46f6..85e3f9b2a61f 100644
>> --- a/mm/percpu.c
>> +++ b/mm/percpu.c
>> @@ -3189,32 +3189,26 @@ void __init __weak pcpu_populate_pte(unsigned long addr)
>> pmd_t *pmd;
>>
>> if (pgd_none(*pgd)) {
>> - p4d_t *new;
>> -
>> - new = memblock_alloc(P4D_TABLE_SIZE, P4D_TABLE_SIZE);
>> - if (!new)
>> + p4d = memblock_alloc(P4D_TABLE_SIZE, P4D_TABLE_SIZE);
>> + if (!p4d)
>> goto err_alloc;
>> - pgd_populate(&init_mm, pgd, new);
>> + pgd_populate(&init_mm, pgd, p4d);
>> }
>>
>> p4d = p4d_offset(pgd, addr);
>> if (p4d_none(*p4d)) {
>> - pud_t *new;
>> -
>> - new = memblock_alloc(PUD_TABLE_SIZE, PUD_TABLE_SIZE);
>> - if (!new)
>> + pud = memblock_alloc(PUD_TABLE_SIZE, PUD_TABLE_SIZE);
>> + if (!pud)
>> goto err_alloc;
>> - p4d_populate(&init_mm, p4d, new);
>> + p4d_populate(&init_mm, p4d, pud);
>> }
>>
>> pud = pud_offset(p4d, addr);
>> if (pud_none(*pud)) {
>> - pmd_t *new;
>> -
>> - new = memblock_alloc(PMD_TABLE_SIZE, PMD_TABLE_SIZE);
>> - if (!new)
>> + pmd = memblock_alloc(PMD_TABLE_SIZE, PMD_TABLE_SIZE);
>> + if (!pmd)
>> goto err_alloc;
>> - pud_populate(&init_mm, pud, new);
>> + pud_populate(&init_mm, pud, pmd);
>> }
>>
>> pmd = pmd_offset(pud, addr);
>> --
>> 2.27.0
>>
>
> I've pulled this, but the other 2 are part of loongarch and should be
> reviewed and pulled by those maintainers.
Dennis,
Thanks for your feedback.
Huacai,
Could you give some review comments about the remaining 2 patches?
Regards
Bibo Mao
>
> Thanks,
> Dennis
next prev parent reply other threads:[~2023-07-28 1:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-12 3:16 [PATCH 0/3] LoongArch: mm: Code cleanup with populate pte Bibo Mao
2023-07-12 3:16 ` [PATCH 1/3] mm/percpu: Remove some local variables in pcpu_populate_pte Bibo Mao
2023-07-27 23:08 ` Dennis Zhou
2023-07-28 1:13 ` bibo mao [this message]
2023-07-12 3:16 ` [PATCH 2/3] LoongArch: Code cleanup in function pcpu_populate_pte Bibo Mao
2023-07-31 14:15 ` Huacai Chen
2023-08-01 1:18 ` bibo mao
2023-07-12 3:16 ` [PATCH 3/3] LoongArch: mm: Add unified function populate_kernel_pte Bibo Mao
2023-07-31 14:15 ` Huacai Chen
2023-08-01 1:22 ` bibo mao
2023-08-02 7:25 ` Huacai Chen
2023-08-10 4:08 ` bibo mao
2023-08-10 4:27 ` Huacai Chen
2023-08-10 4:42 ` bibo mao
2023-07-25 0:36 ` [PATCH 0/3] LoongArch: mm: Code cleanup with populate pte bibo mao
2023-07-25 2:33 ` Dennis Zhou
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=893f8801-b36d-8146-93a6-e97b29826980@loongson.cn \
--to=maobibo@loongson.cn \
--cc=akpm@linux-foundation.org \
--cc=chenhuacai@kernel.org \
--cc=cl@linux.com \
--cc=dennis@kernel.org \
--cc=kernel@xen0n.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=loongarch@lists.linux.dev \
--cc=tj@kernel.org \
/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