On 2024/10/15 13:20, Bagas Sanjaya wrote: ... >> >> +/** >> + * page_frag_cache_is_pfmemalloc() - Check for pfmemalloc. >> + * @nc: page_frag cache from which to check >> + * >> + * Used to check if the current page in page_frag cache is pfmemalloc'ed. > is allocated by pfmemalloc()? There seems to be no pfmemalloc() function. Perhaps change it to something like below as the comment in page_is_pfmemalloc(): Used to check if the current page in page_frag cache is allocated from the pfmemalloc reserves. >> + * It has the same calling context expectation as the alloc API. >> + * >> + * Return: >> + * true if the current page in page_frag cache is pfmemalloc'ed, otherwise >> + * return false. >> + */ >> static inline bool page_frag_cache_is_pfmemalloc(struct page_frag_cache *nc) >> { >> return encoded_page_decode_pfmemalloc(nc->encoded_page); >> } >> >> +/** >> + * page_frag_cache_page_offset() - Return the current page fragment's offset. >> + * @nc: page_frag cache from which to check >> + * >> + * The API is only used in net/sched/em_meta.c for historical reason, do not use >> + * it for new caller unless there is a strong reason. > > Then what does page_frag_cache_page_offset() do then? It is used to replace the the below direct access of 'page_frag_cache': https://elixir.bootlin.com/linux/v6.11/source/net/sched/em_meta.c#L585 Each one of 'page_frag_cache' instance has its own allocation context to ensure lockless access, it is not encouraged to access 'page_frag_cache' directly outside of the allocation context as the accessing is unreliable.