Re: [PATCH 4/5] mm: Simplify folio_memcg_charged()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 13, 2025 at 02:58:53PM +0000, Matthew Wilcox (Oracle) wrote:
> There's no need to check which kind of pointer is in the memcg_data
> field, all we actually care about is whether it's zero or not.
> Saves 70 bytes in workingset_activation() with the Debian config.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> ---
>  include/linux/memcontrol.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 381c5b565dca..28c251e34cdf 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -438,9 +438,7 @@ static inline struct mem_cgroup *folio_memcg(struct folio *folio)
>   */
>  static inline bool folio_memcg_charged(struct folio *folio)
>  {
> -	if (folio_memcg_kmem(folio))
> -		return __folio_objcg(folio) != NULL;
> -	return __folio_memcg(folio) != NULL;
> +	return folio->memcg_data != 0;

I suppose we lose a few DEBUG_VM asserts, but no doubt this function
is unnecessarily complicated.

Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux