From: Michal Hocko <mhocko@suse.com>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: Waiman Long <longman@redhat.com>, Marc Zyngier <maz@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Clark Williams <clrkwllms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH 1/2] gfp_types: Introduce a new GFP_ATOMIC_RT gfp flag
Date: Wed, 27 May 2026 10:41:11 +0200 [thread overview]
Message-ID: <ahauJ9DAqBPnRi1h@tiehlicka> (raw)
In-Reply-To: <16b36b01-7da2-4ec4-aefa-f06216ec218a@kernel.org>
On Tue 26-05-26 15:55:09, Vlastimil Babka (SUSE) wrote:
> On 5/25/26 10:41 AM, Michal Hocko wrote:
> > On Wed 20-05-26 16:46:27, Waiman Long wrote:
> >> The GFP_ATOMIC flag is to be used in atomic context where user cannot
> >> sleep and need the allocation to succeed. However, it does not support
> >> contexts where preemption or interrupt is disabled under PREEMPT_RT
> >> like raw_spin_lock_irqsave() or plain preempt_disable().
> >>
> >> With the advance of the ALLOC_TRYLOCK allocation flag in the v7.1
> >> kernel, it is possible to allocate memory under such contexts by using
> >> spin_trylock to acquire the spinlock in the memory allocation path. This
> >> does increase the chance that the allocation can fail due to the presence
> >> of concurrent memory allocation requests. So its users must be able to
> >> handle such memory allocation failure gracefully.
> >>
> >> The ALLOC_TRYLOCK flag will only be enabled if none of the
> >> ___GFP_DIRECT_RECLAIM and ___GFP_KSWAPD_RECLAIM flags are set.
> >>
> >> Introduce a new GFP_ATOMIC_RT gfp flag for those PREEMPT_RT
> >> atomic contexts. This new flag will fall back to GFP_ATOMIC in
> >> non-PREEMPT_RT kernel. GFP_ATOMIC can continue to be used in contexts
> >> where preemption and interrupt are not disabled in PREEMPT_RT kernel
> >> like spin_lock_irqsave().
> >
> > Before we go this way we need to really be clear we do want to support
> > raw_spinlock (aka RT) contexts. This is a big commitment because it
> > dictates internal allocator locking that would have potentially a much
> > bigger impact long term. I would go this way only after/when we conclude
> > there is absolutely no other way and we need to have allocator in those
> > critical sections. Now you have a single place which complains ATM
>
> We already have alloc_pages_nolock() which uses ALLOC_TRYLOCK internally
> for these limited contexts. So the support and commitment exist. This
> just exposes it via a new gfp flag alias. But if there's a single user
> and it's already disputed, we don't have to expose it that way indeed.
alloc_pages_nolock is a very constrained allocation context with a very
limited use. That is quite different from something as generically named
as GFP_ATOMIC_RT that one could assume is a good fit for RT sensitive
allocations in general.
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2026-05-27 8:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 20:46 [PATCH 1/2] gfp_types: Introduce a new GFP_ATOMIC_RT gfp flag Waiman Long
2026-05-20 20:46 ` [PATCH 2/2] irqchip/gic-v3-its: Use GFP_ATOMIC_RT gfp flag in allocate_vpe_l1_table() Waiman Long
2026-05-22 8:17 ` Marc Zyngier
2026-05-22 9:06 ` Lorenzo Stoakes
2026-05-21 16:40 ` [PATCH 1/2] gfp_types: Introduce a new GFP_ATOMIC_RT gfp flag Lorenzo Stoakes
2026-05-21 17:40 ` Waiman Long
2026-05-22 8:46 ` Lorenzo Stoakes
2026-05-25 8:41 ` Michal Hocko
2026-05-26 8:28 ` Sebastian Andrzej Siewior
2026-05-26 13:55 ` Vlastimil Babka (SUSE)
2026-05-27 8:41 ` Michal Hocko [this message]
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=ahauJ9DAqBPnRi1h@tiehlicka \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=clrkwllms@kernel.org \
--cc=david@kernel.org \
--cc=liam@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=ljs@kernel.org \
--cc=longman@redhat.com \
--cc=maz@kernel.org \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=tglx@linutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox