linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: Bagas Sanjaya <bagasdotme@gmail.com>, <davem@davemloft.net>,
	<kuba@kernel.org>, <pabeni@redhat.com>
Cc: Linux Networking <netdev@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Alexander Duyck <alexander.duyck@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Linux Documentation <linux-doc@vger.kernel.org>
Subject: Re: [PATCH net-next v21 13/14] mm: page_frag: update documentation for page_frag
Date: Tue, 15 Oct 2024 18:58:39 +0800	[thread overview]
Message-ID: <d814c044-8a0d-48fd-9fc1-06aa457c46c6@huawei.com> (raw)
In-Reply-To: <Zw37nCqT4RY1udAK@archie.me>

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.


      reply	other threads:[~2024-10-15 10:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241012112320.2503906-1-linyunsheng@huawei.com>
2024-10-12 11:23 ` [PATCH net-next v21 01/14] mm: page_frag: add a test module " Yunsheng Lin
2024-10-12 11:23 ` [PATCH net-next v21 02/14] mm: move the page fragment allocator from page_alloc into its own file Yunsheng Lin
2024-10-12 11:23 ` [PATCH net-next v21 03/14] mm: page_frag: use initial zero offset for page_frag_alloc_align() Yunsheng Lin
2024-10-12 11:23 ` [PATCH net-next v21 04/14] mm: page_frag: avoid caller accessing 'page_frag_cache' directly Yunsheng Lin
2024-10-12 11:23 ` [PATCH net-next v21 06/14] mm: page_frag: reuse existing space for 'size' and 'pfmemalloc' Yunsheng Lin
2024-10-12 11:23 ` [PATCH net-next v21 07/14] mm: page_frag: some minor refactoring before adding new API Yunsheng Lin
2024-10-12 11:23 ` [PATCH net-next v21 08/14] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Yunsheng Lin
2024-10-12 11:23 ` [PATCH net-next v21 10/14] mm: page_frag: introduce prepare/probe/commit API Yunsheng Lin
2024-10-12 11:23 ` [PATCH net-next v21 11/14] mm: page_frag: add testing for the newly added prepare API Yunsheng Lin
2024-10-12 11:23 ` [PATCH net-next v21 13/14] mm: page_frag: update documentation for page_frag Yunsheng Lin
2024-10-15  5:20   ` Bagas Sanjaya
2024-10-15 10:58     ` Yunsheng Lin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d814c044-8a0d-48fd-9fc1-06aa457c46c6@huawei.com \
    --to=linyunsheng@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.duyck@gmail.com \
    --cc=bagasdotme@gmail.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox