From: "Huang, Ying" <ying.huang@intel.com>
To: Yanfei Xu <yanfei.xu@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, 02 Sep 2024 09:37:29 +0800 [thread overview]
Message-ID: <87wmjug7ja.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <d8a514df-45ad-445a-a3da-2feaa7997d9b@intel.com> (Yanfei Xu's message of "Fri, 30 Aug 2024 17:53:15 +0800")
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>
next prev parent reply other threads:[~2024-09-02 1:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 11:36 Yanfei Xu
2024-08-30 7:11 ` Huang, Ying
2024-08-30 9:53 ` Yanfei Xu
2024-09-02 1:37 ` Huang, Ying [this message]
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=87wmjug7ja.fsf@yhuang6-desk2.ccr.corp.intel.com \
--to=ying.huang@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=horen.chuang@linux.dev \
--cc=linux-mm@kvack.org \
--cc=yanfei.xu@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