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: Fri, 30 Aug 2024 17:53:15 +0800 [thread overview]
Message-ID: <d8a514df-45ad-445a-a3da-2feaa7997d9b@intel.com> (raw)
In-Reply-To: <87ed66h4d1.fsf@yhuang6-desk2.ccr.corp.intel.com>
[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__);
Best Regards,
Yanfei
>
> --
> Best Regards,
> Huang, Ying
next prev parent reply other threads:[~2024-08-30 9:53 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 [this message]
2024-09-02 1:37 ` Huang, Ying
2024-09-02 8:56 ` Yanfei Xu
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=d8a514df-45ad-445a-a3da-2feaa7997d9b@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).