From: Dave Hansen <dave.hansen@intel.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@kernel.org>,
David Hildenbrand <david@redhat.com>,
Vlastimil Babka <vbabka@suse.cz>,
Mel Gorman <mgorman@techsingularity.net>,
Tom Lendacky <thomas.lendacky@amd.com>,
"Kalra, Ashish" <ashish.kalra@amd.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
linux-mm@kvack.org, linux-coco@lists.linux.dev,
linux-kernel@vger.kernel.org, Srikanth Aithal <sraithal@amd.com>
Subject: Re: [PATCH] mm/page_alloc: fix deadlock on cpu_hotplug_lock in __accept_page()
Date: Mon, 31 Mar 2025 12:07:07 -0700 [thread overview]
Message-ID: <b44cef03-46ef-4153-b21a-98aa6ff43a08@intel.com> (raw)
In-Reply-To: <20250329171030.3942298-1-kirill.shutemov@linux.intel.com>
On 3/29/25 10:10, Kirill A. Shutemov wrote:
> + if (system_wq)
> + schedule_work(&zone->unaccepted_cleanup);
> + else
> + unaccepted_cleanup_work(&zone->unaccepted_cleanup);
> + }
> }
The 'system_wq' check seems like an awfully big hack. No other
schedule_work() user does anything similar that I can find across the tree.
Instead of hacking in some internal state, could you use 'system_state',
like:
if (system_state == SYSTEM_BOOTING)
unaccepted_cleanup_work(&zone->unaccepted_cleanup);
else
schedule_work(&zone->unaccepted_cleanup);
The other method would be to make it more opportunistic? Basically,
detect when it might deadlock:
bool try_to_dec()
{
if (!cpus_read_trylock())
return false;
static_branch_dec_cpuslocked(&zones_with_unaccepted_pages);
cpus_read_unlock();
return true;
}
That still requires a bit in the zone to say whether the
static_branch_dec() was deferred or not, though. It's kinda open-coding
schedule_work().
next parent reply other threads:[~2025-03-31 19:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250329171030.3942298-1-kirill.shutemov@linux.intel.com>
2025-03-31 19:07 ` Dave Hansen [this message]
2025-04-01 7:25 ` Kirill A. Shutemov
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=b44cef03-46ef-4153-b21a-98aa6ff43a08@intel.com \
--to=dave.hansen@intel.com \
--cc=akpm@linux-foundation.org \
--cc=ashish.kalra@amd.com \
--cc=david@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=rick.p.edgecombe@intel.com \
--cc=rppt@kernel.org \
--cc=sraithal@amd.com \
--cc=thomas.lendacky@amd.com \
--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