linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zhongkun He <hezhongkun.hzk@bytedance.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: mhocko@suse.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	 Kent Overstreet <kent.overstreet@linux.dev>
Subject: Re: [External] Re: [PATCH] mm: rename the oldflags and parameter in memalloc_flags_*()
Date: Thu, 19 Jun 2025 10:50:39 +0800	[thread overview]
Message-ID: <CACSyD1NZPY3wS4WnuP-UpH3vuLWLS=eXxQLtqcO+1g7VNmBx1g@mail.gmail.com> (raw)
In-Reply-To: <20250618164334.54616cb2d70a1ee3c1f28a81@linux-foundation.org>

On Thu, Jun 19, 2025 at 7:43 AM Andrew Morton <akpm@linux-foundation.org> wrote:
>
> On Wed, 18 Jun 2025 15:03:28 +0800 Zhongkun He <hezhongkun.hzk@bytedance.com> wrote:
>
> > The variable name oldflags can indeed be misleading, because
> > it does not store the complete original value of flags.
> > Instead, it records which flags from the given set are not
> > currently set. So rename it.
> >
>
> Your email client is mangling the patches in strange ways.  Please send
> yourself a patch, figure out why it didn't apply?

Thank you for pointing that out. I’ll check the email formatting on my side.
Sorry for the trouble caused.

>
> > --- a/include/linux/sched/mm.h
> > +++ b/include/linux/sched/mm.h
> > @@ -322,21 +322,21 @@ static inline void might_alloc(gfp_t gfp_mask)
> >  }
> >
> >  /**
> > - * memalloc_flags_save - Add a PF_* flag to current->flags, save old value
> > + * memalloc_flags_save - Add a PF_* flag to current->flags, return saved flags mask
> >   *
> >   * This allows PF_* flags to be conveniently added, irrespective of current
> >   * value, and then the old version restored with memalloc_flags_restore().
> >   */
> > -static inline unsigned memalloc_flags_save(unsigned flags)
> > +static inline unsigned int memalloc_flags_save(unsigned int flags_mask)
> >  {
> > -     unsigned oldflags = ~current->flags & flags;
> > -     current->flags |= flags;
> > -     return oldflags;
> > +     unsigned int saved_flags_mask = ~current->flags & flags_mask;
> > +
> > +     current->flags |= flags_mask;
> > +     return saved_flags_mask;
> >  }
> >
> > -static inline void memalloc_flags_restore(unsigned flags)
> > +static inline void memalloc_flags_restore(unsigned int flags_mask)
> >  {
> > -     current->flags &= ~flags;
> > +     current->flags &= ~flags_mask;
> >  }
>
> I guess so.  Maybe.  A bit.  Kent, what do you think?


      parent reply	other threads:[~2025-06-19  2:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18  7:03 Zhongkun He
2025-06-18 23:43 ` Andrew Morton
2025-06-19  0:07   ` Kent Overstreet
2025-06-19  3:17     ` [External] " Zhongkun He
2025-06-19  4:16       ` Kent Overstreet
2025-06-19  4:36         ` Zhongkun He
2025-06-19  2:50   ` Zhongkun He [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='CACSyD1NZPY3wS4WnuP-UpH3vuLWLS=eXxQLtqcO+1g7VNmBx1g@mail.gmail.com' \
    --to=hezhongkun.hzk@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=kent.overstreet@linux.dev \
    --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