From: Miaohe Lin <linmiaohe@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <vbabka@suse.cz>, <pintu@codeaurora.org>,
<charante@codeaurora.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH 09/12] mm: compaction: avoid possible NULL pointer dereference in kcompactd_cpu_online
Date: Tue, 19 Apr 2022 14:47:56 +0800 [thread overview]
Message-ID: <df57934c-0738-208b-d423-59032185f858@huawei.com> (raw)
In-Reply-To: <20220418205531.2e4ed0f72e0e537ef55c6468@linux-foundation.org>
On 2022/4/19 11:55, Andrew Morton wrote:
> Please cc David H on memhotplug stuff.
I'm relying on the scripts/get_maintainer.pl to take me the right people now.
Will take care of it. Many thanks for your remind!
>
> On Mon, 18 Apr 2022 22:12:50 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:
>
>> It's possible that kcompactd_run could fail to run kcompactd for a hot
>> added node and leave pgdat->kcompactd as NULL. So pgdat->kcompactd should
>> be checked here to avoid possible NULL pointer dereference.
>>
>> ..
>>
>> --- a/mm/compaction.c
>> +++ b/mm/compaction.c
>> @@ -3052,7 +3052,8 @@ static int kcompactd_cpu_online(unsigned int cpu)
>>
>> if (cpumask_any_and(cpu_online_mask, mask) < nr_cpu_ids)
>> /* One of our CPUs online: restore mask */
>> - set_cpus_allowed_ptr(pgdat->kcompactd, mask);
>> + if (pgdat->kcompactd)
>> + set_cpus_allowed_ptr(pgdat->kcompactd, mask);
>> }
>> return 0;
>> }
>
> Why not fail to bring the node online if kcompactd_run() failed?
kcompactd_run() is allowed to fail since it's introduced via commit 698b1b30642 ("mm, compaction: introduce kcompactd").
>
> Also, should we panic the system if kcompactd_run() failed in
> kcompactd_init()?
So I think this might not be a critical issue. We could live with it anyway.
And in fact, CONFIG_COMPACTION is even not enabled in some systems.
Thanks!
>
> .
>
next prev parent reply other threads:[~2022-04-19 6:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-18 14:12 [PATCH 00/12] A few cleanup and fixup patches for compaction Miaohe Lin
2022-04-18 14:12 ` [PATCH 01/12] mm: compaction: remove unneeded return value of kcompactd_run Miaohe Lin
2022-04-18 14:12 ` [PATCH 02/12] mm: compaction: remove unneeded pfn update Miaohe Lin
2022-04-18 14:12 ` [PATCH 03/12] mm: compaction: remove unneeded assignment to isolate_start_pfn Miaohe Lin
2022-04-18 14:12 ` [PATCH 04/12] mm: compaction: clean up comment for sched contention Miaohe Lin
2022-04-18 14:12 ` [PATCH 05/12] mm: compaction: clean up comment about suitable migration target recheck Miaohe Lin
2022-04-18 14:12 ` [PATCH 06/12] mm: compaction: use COMPACT_CLUSTER_MAX in compaction.c Miaohe Lin
2022-04-18 14:12 ` [PATCH 07/12] mm: compaction: use helper compound_nr in isolate_migratepages_block Miaohe Lin
2022-04-18 14:12 ` [PATCH 08/12] mm: compaction: clean up comment about async compaction in isolate_migratepages Miaohe Lin
2022-04-18 14:12 ` [PATCH 09/12] mm: compaction: avoid possible NULL pointer dereference in kcompactd_cpu_online Miaohe Lin
2022-04-19 3:55 ` Andrew Morton
2022-04-19 6:47 ` Miaohe Lin [this message]
2022-04-19 7:42 ` David Hildenbrand
2022-04-19 11:05 ` Miaohe Lin
2022-04-18 14:12 ` [PATCH 10/12] mm: compaction: make compaction_zonelist_suitable return false when COMPACT_SUCCESS Miaohe Lin
2022-04-18 14:12 ` [PATCH 11/12] mm: compaction: simplify the code in __compact_finished Miaohe Lin
2022-04-18 14:12 ` [PATCH 12/12] mm: compaction: make sure highest is above the min_pfn Miaohe Lin
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=df57934c-0738-208b-d423-59032185f858@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=charante@codeaurora.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pintu@codeaurora.org \
--cc=vbabka@suse.cz \
/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
all inboxes | Powered by JetHome®