From: Yanfei Xu <yanfei.xu@intel.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: <akpm@linux-foundation.org>, <horen.chuang@linux.dev>,
<Jonathan.Cameron@huawei.com>, <linux-mm@kvack.org>
Subject: Re: [PATCH] memory tier: fix deadlock warning while onlining pages
Date: Mon, 2 Sep 2024 16:56:33 +0800 [thread overview]
Message-ID: <ba5b2e7e-c80d-4b38-a8f7-7ce4bfb3bcc7@intel.com> (raw)
In-Reply-To: <87wmjug7ja.fsf@yhuang6-desk2.ccr.corp.intel.com>
On 9/2/2024 9:37 AM, Huang, Ying wrote:
> Yanfei Xu <yanfei.xu@intel.com> writes:
>
>> [Snip]
>>
>> On 8/30/2024 3:11 PM, Huang, Ying wrote:
>>>> Fixes: 823430c8e9d9 ("memory tier: consolidate the initialization of memory tiers")
>>>> Signed-off-by: Yanfei Xu<yanfei.xu@intel.com>
>>>> ---
>>>> mm/memory-tiers.c | 1 -
>>>> 1 file changed, 1 deletion(-)
>>>>
>>>> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
>>>> index 4775b3a3dabe..dddcd6b38e28 100644
>>>> --- a/mm/memory-tiers.c
>>>> +++ b/mm/memory-tiers.c
>>>> @@ -895,7 +895,6 @@ static int __init memory_tier_init(void)
>>>> WARN_ON(!node_demotion);
>>>> #endif
>>>> - guard(mutex)(&memory_tier_lock);
>>>> /*
>>>> * For now we can have 4 faster memory tiers with smaller adistance
>>>> * than default DRAM tier.
>>> Although it's not absolutely necessary, I still think that it's better
>>> to just revert the locking change of memory_tier_init() in commit
>>> 823430c8e9d9 ("memory tier: consolidate the initialization of memory
>>> tiers"). That is, to use mutex_lock/unlock() and exclude
>>> hotplug_memory_notifier() from the locked region. Because we will
>>> always hold memory_tier_lock when working on memory tier related data
>>> structures in this way.
>>
>> Thanks for pointing out it. Will do it as below in v2.
>>
>> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
>> index 4775b3a3dabe..ba3738b29cc5 100644
>> --- a/mm/memory-tiers.c
>> +++ b/mm/memory-tiers.c
>> @@ -895,13 +895,14 @@ static int __init memory_tier_init(void)
>> WARN_ON(!node_demotion);
>> #endif
>>
>> - guard(mutex)(&memory_tier_lock);
>> + mutex_lock(&memory_tier_lock);
>> /*
>> * For now we can have 4 faster memory tiers with smaller adistance
>> * than default DRAM tier.
>> */
>> default_dram_type =
>> mt_find_alloc_memory_type(MEMTIER_ADISTANCE_DRAM,
>> &default_memory_types);
>> + mutex_unlock(&memory_tier_lock);
>> if (IS_ERR(default_dram_type))
>> panic("%s() failed to allocate default DRAM tier\n",
>> __func__);
>>
>>
>
> LGTM, feel free to add in the future version.
>
> Reviewed-by: "Huang, Ying" <ying.huang@intel.com>
>
Hi Ying,
Thanks for your "Reviewed-by"! I sent the v2 last Friday evening. Could
you please reply to that thread with the "Reviewed-by"? If not, I can
send v3 and include your tag.
Thread name:
8/30/2024, 6:24 PM [PATCH v2] memory tier: fix deadlock warning while
onlining pages
Best Regards,
Yanfei
prev parent reply other threads:[~2024-09-02 11:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 11:36 [PATCH] memory tier: fix deadlock warning while onlining pages Yanfei Xu
2024-08-30 7:11 ` Huang, Ying
2024-08-30 9:53 ` Yanfei Xu
2024-09-02 1:37 ` Huang, Ying
2024-09-02 8:56 ` Yanfei Xu [this message]
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=ba5b2e7e-c80d-4b38-a8f7-7ce4bfb3bcc7@intel.com \
--to=yanfei.xu@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=horen.chuang@linux.dev \
--cc=linux-mm@kvack.org \
--cc=ying.huang@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).