[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d814c044-8a0d-48fd-9fc1-06aa457c46c6@huawei.com>
Date: Tue, 15 Oct 2024 18:58:39 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: Bagas Sanjaya <bagasdotme@...il.com>, <davem@...emloft.net>,
<kuba@...nel.org>, <pabeni@...hat.com>
CC: Linux Networking <netdev@...r.kernel.org>, Linux Kernel Mailing List
<linux-kernel@...r.kernel.org>, Alexander Duyck <alexander.duyck@...il.com>,
Jonathan Corbet <corbet@....net>, Andrew Morton <akpm@...ux-foundation.org>,
Linux Memory Management List <linux-mm@...ck.org>, Linux Documentation
<linux-doc@...r.kernel.org>
Subject: Re: [PATCH net-next v21 13/14] mm: page_frag: update documentation
for page_frag
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.
Powered by blists - more mailing lists