linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Zhongkun He <hezhongkun.hzk@bytedance.com>
Cc: mhocko@suse.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Kent Overstreet <kent.overstreet@linux.dev>
Subject: Re: [PATCH] mm: rename the oldflags and parameter in memalloc_flags_*()
Date: Wed, 18 Jun 2025 16:43:34 -0700	[thread overview]
Message-ID: <20250618164334.54616cb2d70a1ee3c1f28a81@linux-foundation.org> (raw)
In-Reply-To: <20250618070328.2192849-1-hezhongkun.hzk@bytedance.com>

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?

> --- 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?


  reply	other threads:[~2025-06-18 23:43 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 [this message]
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

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=20250618164334.54616cb2d70a1ee3c1f28a81@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hezhongkun.hzk@bytedance.com \
    --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