[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <df57934c-0738-208b-d423-59032185f858@huawei.com>
Date: Tue, 19 Apr 2022 14:47:56 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: <vbabka@...e.cz>, <pintu@...eaurora.org>,
<charante@...eaurora.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>,
David Hildenbrand <david@...hat.com>
Subject: Re: [PATCH 09/12] mm: compaction: avoid possible NULL pointer
dereference in kcompactd_cpu_online
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@...wei.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!
>
> .
>
Powered by blists - more mailing lists