* Re: [PATCH v2 1/2] mm: introduce memalloc_flags_move() for transferring allocation scopes [not found] ` <20260719095732.1813590-2-yun.zhou@windriver.com> @ 2026-07-19 20:57 ` Andrew Morton 2026-07-20 4:43 ` Zhou, Yun 0 siblings, 1 reply; 2+ messages in thread From: Andrew Morton @ 2026-07-19 20:57 UTC (permalink / raw) To: Yun Zhou Cc: cem, djwong, hch, willy, hwenwur, linux-xfs, linux-kernel, linux-mm On Sun, 19 Jul 2026 17:57:31 +0800 Yun Zhou <yun.zhou@windriver.com> wrote: > Add memalloc_flags_move() to transfer a saved memalloc scope from one > tracking variable to another. The source is zeroed so that a > subsequent memalloc_flags_restore() on it becomes a no-op, effectively > transferring ownership of the scope to the destination. > > This is needed when a subsystem hands off an allocation context from > one structure to another (e.g. during transaction rolling in > filesystems), and needs to ensure the scope remains active without an > extra save/restore cycle. > > ... > Thanks. fyi, Sashiko might have found a pre-existing xfs issue: https://sashiko.dev/#/patchset/20260719095732.1813590-1-yun.zhou@windriver.com > include/linux/sched/mm.h | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) This file isn't mentioned in MAINTAINERS. Could someone please propose a patch? From the MM side, probably just place it in every record which mentions include/linux/mm.h - close enough. > --- a/include/linux/sched/mm.h > +++ b/include/linux/sched/mm.h > @@ -342,6 +342,23 @@ static inline void memalloc_flags_restore(unsigned flags) > current->flags &= ~flags; > } > > +/** > + * memalloc_flags_move - transfer a memalloc scope from one tracking > + * variable to another. > + * @old_flags: pointer to the source flags (will be zeroed) > + * > + * Returns the flags value to store in the destination. The source is > + * set to zero so that a subsequent memalloc_flags_restore() on it is > + * a no-op. > + */ > +static inline unsigned int memalloc_flags_move(unsigned int *old_flags) > +{ > + unsigned int ret = *old_flags; > + > + *old_flags = 0; > + return ret; > +} > + I've added linux-mm to cc here. Please include it in any future versions of this patchset. ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/2] mm: introduce memalloc_flags_move() for transferring allocation scopes 2026-07-19 20:57 ` [PATCH v2 1/2] mm: introduce memalloc_flags_move() for transferring allocation scopes Andrew Morton @ 2026-07-20 4:43 ` Zhou, Yun 0 siblings, 0 replies; 2+ messages in thread From: Zhou, Yun @ 2026-07-20 4:43 UTC (permalink / raw) To: Andrew Morton Cc: cem, djwong, hch, willy, hwenwur, linux-xfs, linux-kernel, linux-mm On 7/20/26 04:57, Andrew Morton wrote: > On Sun, 19 Jul 2026 17:57:31 +0800 Yun Zhou <yun.zhou@windriver.com> wrote: > >> Add memalloc_flags_move() to transfer a saved memalloc scope from one >> tracking variable to another. The source is zeroed so that a >> subsequent memalloc_flags_restore() on it becomes a no-op, effectively >> transferring ownership of the scope to the destination. >> >> This is needed when a subsystem hands off an allocation context from >> one structure to another (e.g. during transaction rolling in >> filesystems), and needs to ensure the scope remains active without an >> extra save/restore cycle. >> >> ... >> > > Thanks. fyi, Sashiko might have found a pre-existing xfs issue: > https://sashiko.dev/#/patchset/20260719095732.1813590-1-yun.zhou@windriver.com > Good catch. This is indeed a pre-existing issue, and needs a separate fix. >> include/linux/sched/mm.h | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) > > This file isn't mentioned in MAINTAINERS. Could someone please propose > a patch? > > From the MM side, probably just place it in every record which mentions > include/linux/mm.h - close enough. > >> --- a/include/linux/sched/mm.h >> +++ b/include/linux/sched/mm.h >> @@ -342,6 +342,23 @@ static inline void memalloc_flags_restore(unsigned flags) >> current->flags &= ~flags; >> } >> >> +/** >> + * memalloc_flags_move - transfer a memalloc scope from one tracking >> + * variable to another. >> + * @old_flags: pointer to the source flags (will be zeroed) >> + * >> + * Returns the flags value to store in the destination. The source is >> + * set to zero so that a subsequent memalloc_flags_restore() on it is >> + * a no-op. >> + */ >> +static inline unsigned int memalloc_flags_move(unsigned int *old_flags) >> +{ >> + unsigned int ret = *old_flags; >> + >> + *old_flags = 0; >> + return ret; >> +} >> + > > I've added linux-mm to cc here. Please include it in any future > versions of this patchset. > Well, got it. Thanks, Yun ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-20 4:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260719095732.1813590-1-yun.zhou@windriver.com>
[not found] ` <20260719095732.1813590-2-yun.zhou@windriver.com>
2026-07-19 20:57 ` [PATCH v2 1/2] mm: introduce memalloc_flags_move() for transferring allocation scopes Andrew Morton
2026-07-20 4:43 ` Zhou, Yun
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox