# Re: \[PATCH v14 038/138\] mm/memcg: Add folio\_memcg() and related functions

- From: Vlastimil Babka \<hidden\>
- Date: 2021-08-11 10:32:49 
- List: linux-mm
- Page: https://ratatoskr.run/linux-mm/2021/08/212087
- Thread: https://ratatoskr.run/linux-mm/2021/07/209943/t/5.md

```text
On 7/15/21 5:35 AM, Matthew Wilcox (Oracle) wrote:
> memcg information is only stored in the head page, so the memcg
> subsystem needs to assure that all accesses are to the head page.
> The first step is converting page_memcg() to folio_memcg().
> 
> The callers of page_memcg() and PageMemcgKmem() are not yet ready to be
> converted to use folios, so retain them as wrappers around folio_memcg()
> and folio_memcg_kmem().  They will be converted in a later patch set.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Reviewed-by: Christoph Hellwig <hch@lst.de>


Acked-by: Vlastimil Babka <redacted>


Nit:

> ---
>  include/linux/memcontrol.h | 109 ++++++++++++++++++++++---------------
>  mm/memcontrol.c            |  21 ++++---
>  2 files changed, 77 insertions(+), 53 deletions(-)
> 
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index bfe5c486f4ad..eabae5874161 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -372,6 +372,7 @@ enum page_memcg_data_flags {
>  #define MEMCG_DATA_FLAGS_MASK (__NR_MEMCG_DATA_FLAGS - 1)
>  
>  static inline bool PageMemcgKmem(struct page *page);

I think this fwd declaration is no longer needed.

> +static inline bool folio_memcg_kmem(struct folio *folio);
>  

```
