linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Michal Hocko <mhocko@suse.com>
Cc: Dennis Zhou <dennis@kernel.org>,
	Filipe Manana <fdmanana@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm, percpu: do not consider sleepable allocations atomic
Date: Wed, 12 Feb 2025 08:14:35 -1000	[thread overview]
Message-ID: <Z6zlC3juT46dLHr9@slm.duckdns.org> (raw)
In-Reply-To: <Z6zS4Dtyway78Gif@tiehlicka>

Hello,

On Wed, Feb 12, 2025 at 05:57:04PM +0100, Michal Hocko wrote:
...
> I have gone with masking because that seemed easier to review and more
> robust solution. vmalloc does support NOFS/NOIO contexts these days (it
> will just uses scoped masking in those cases). Propagating the gfp

I see. Nice.

> throughout the worker code path is likely possible, but I haven't really
> explored that in detail to be sure. Would that be preferable even if the
> fix would be more involved?

Longer term, yeah, I think so.

> > Also, doesn't the above always prevent percpu allocations from doing fs/io
> > reclaims? 
> 
> Yes it does. Probably worth mentioning in the changelog. These
> allocations should be rare so having a constrained reclaim didn't really
> seem problematic to me. There should be kswapd running in the background
> with the full reclaim power.

Hmm... you'd a better judge on whether that'd be okay or not but it does
bother me that we might be increasing the chance of allocation failures for
GFP_KERNEL users at least under memory pressure.

> > ie. Shouldn't the masking only be used if the passed in gfp
> > doesn't allow fs/io?
> 
> This is a good question. I have to admit that my understanding might be
> incorrect but wouldn't it be possible that we could get the lock
> dependency chain if GFP_KERNEL and scoped NOFS alloc_pcp calls are
> competing? 
> 
> 					fs/io lock
> 					pcpu_alloc_noprof(NOFS/NOIO)
> pcpu_alloc_noprof(GFP_KERNEL)
>   pcpu_schedule_balance_work
>     pcpu_alloc_mutex
>     					  pcpu_alloc_mutex
>       allocation_deadlock throgh fs/io lock
> 
> This is currently not possible because constrained allocations only do
> trylock.

Right, the current locking in expansion path is really simple because it was
assuming everyone would be doing GFP_KERNEL allocation. We'd have to break
up the locking so that allocations are done outside locking, which hopefully
shouldn't be too complicated.

Thanks.

-- 
tejun


  reply	other threads:[~2025-02-12 18:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-06 12:26 Michal Hocko
2025-02-11 15:05 ` Vlastimil Babka
2025-02-11 20:55 ` Tejun Heo
2025-02-12 16:57   ` Michal Hocko
2025-02-12 18:14     ` Tejun Heo [this message]
2025-02-12 20:53       ` Michal Hocko
2025-02-12 21:30         ` Tejun Heo
2025-02-12 21:39           ` Dennis Zhou
2025-02-14 15:52             ` Michal Hocko
2025-02-21  2:36               ` Dennis Zhou
2025-02-21  9:48                 ` Vlastimil Babka
2025-03-05 15:10                   ` Michal Hocko
2025-03-05 15:35                     ` Vlastimil Babka
2025-02-14 15:43           ` Michal Hocko

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=Z6zlC3juT46dLHr9@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dennis@kernel.org \
    --cc=fdmanana@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.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