All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kaitao Cheng <kaitao.cheng@linux.dev>
To: Michal Hocko <mhocko@suse.com>, Dennis Zhou <dennis@kernel.org>
Cc: Pedro Falcato <pfalcato@suse.de>,
	akpm@linux-foundation.org, tj@kernel.org, cl@gentwo.org,
	vbabka@kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, muchun.song@linux.dev,
	Kaitao Cheng <chengkaitao@kylinos.cn>
Subject: Re: [PATCH 1/2] mm/percpu: Preserve NOFS/NOIO scope during chunk create and populate
Date: Tue, 2 Jun 2026 11:03:15 +0800	[thread overview]
Message-ID: <7e913ba8-fa91-4916-a871-66de7c80cd29@linux.dev> (raw)
In-Reply-To: <ah2pD468y1LCIe3G@tiehlicka>



在 2026/6/1 23:45, Michal Hocko 写道:
> On Mon 01-06-26 10:27:53, Kaitao Cheng wrote:
>> However, if we revert 9a5b183941b, it seems that all of these issues would
>> be resolved. The only downside is that the failure rate of pcpu_alloc_noprof()
>> allocations may increase, which might be acceptable.
> 
> That has practical impact on some versions of iscsid which do not have
> PR_SET_IO_FLUSHER. And maybe some more so I would rather not revert
> based on a theoretical concerns which I believe is the case here. 
> 

Based on the previous discussion, I think we have a way to address most
of the concurrency issues around percpu allocation.

However, there still seems to be one remaining case that I do not yet
have a good way to solve. For example:

Thread A calls pcpu_alloc_noprof() with GFP_KERNEL and takes
pcpu_alloc_mutex. Since the internal allocation is not constrained by
NOFS, it may enter FS reclaim while still holding pcpu_alloc_mutex,
creating a dependency like:

pcpu_alloc_mutex -> fs_reclaim -> FS lock
At the same time, Thread B may already hold an FS lock and then call
pcpu_alloc_noprof() with GFP_NOFS. It will try to acquire
pcpu_alloc_mutex and block, creating the reverse dependency:

FS lock -> pcpu_alloc_mutex
This can still form a potential deadlock cycle.

Does anyone have a good suggestion for how to handle this remaining case?
Or should we simply treat all GFP_KERNEL/GFP_NOFS allocation behavior in
pcpu_alloc_noprof() as GFP_NOIO?

If there is no clear solution for now, would it be acceptable to first
fix some of the issues introduced by commit 9a5b183941b, and leave this
remaining case as a pre-existing historical issue to be handled separately
later?

-- 
Thanks
Kaitao Cheng



  reply	other threads:[~2026-06-02  3:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28 13:29 [PATCH 0/2] mm/percpu: Fix possible NOFS/NOIO reclaim recursion Kaitao Cheng
2026-05-28 13:29 ` [PATCH 1/2] mm/percpu: Preserve NOFS/NOIO scope during chunk create and populate Kaitao Cheng
2026-05-29  9:25   ` Pedro Falcato
2026-05-29  9:38     ` Pedro Falcato
2026-05-30 12:47       ` Kaitao Cheng
2026-05-30 13:32         ` Dennis Zhou
2026-06-01  2:27           ` Kaitao Cheng
2026-06-01 15:45             ` Michal Hocko
2026-06-02  3:03               ` Kaitao Cheng [this message]
2026-06-02  7:16                 ` Vlastimil Babka (SUSE)
2026-06-02  8:05                   ` Michal Hocko
2026-06-02  9:02                     ` Kaitao Cheng
2026-06-02  7:17                 ` Michal Hocko
2026-06-02 13:46           ` Pedro Falcato
2026-05-28 13:29 ` [PATCH 2/2] mm/percpu: Avoid pcpu_alloc_mutex recursion from reclaim Kaitao Cheng
2026-05-29  9:34   ` Pedro Falcato
2026-05-28 21:09 ` [PATCH 0/2] mm/percpu: Fix possible NOFS/NOIO reclaim recursion Andrew Morton
2026-05-28 21:10 ` Andrew Morton

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=7e913ba8-fa91-4916-a871-66de7c80cd29@linux.dev \
    --to=kaitao.cheng@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=chengkaitao@kylinos.cn \
    --cc=cl@gentwo.org \
    --cc=dennis@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=pfalcato@suse.de \
    --cc=tj@kernel.org \
    --cc=vbabka@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.