lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250618164334.54616cb2d70a1ee3c1f28a81@linux-foundation.org>
Date: Wed, 18 Jun 2025 16:43:34 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Zhongkun He <hezhongkun.hzk@...edance.com>
Cc: mhocko@...e.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org, Kent
 Overstreet <kent.overstreet@...ux.dev>
Subject: Re: [PATCH] mm: rename the oldflags and parameter in
 memalloc_flags_*()

On Wed, 18 Jun 2025 15:03:28 +0800 Zhongkun He <hezhongkun.hzk@...edance.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?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ