netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen Lin <chen45464546@163.com>
To: kuba@kernel.org
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, alexander.duyck@gmail.com,
	netdev@vger.kernel.org, Chen Lin <chen45464546@163.com>
Subject: Re:Re: [PATCH v2] mm: page_frag: Warn_on when frag_alloc size is bigger than PAGE_SIZE
Date: Tue, 31 May 2022 22:41:12 +0800	[thread overview]
Message-ID: <1654008072-3136-1-git-send-email-chen45464546@163.com> (raw)
In-Reply-To: <20220530122918.549ef054@kernel.org>

At 2022-05-31 02:29:18, "Jakub Kicinski" <kuba@kernel.org> wrote:
>On Mon, 30 May 2022 12:27:05 -0700 Jakub Kicinski wrote:
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index e008a3df0485..360a545ee5e8 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -5537,6 +5537,7 @@ EXPORT_SYMBOL(free_pages);
>>   * sk_buff->head, or to be used in the "frags" portion of skb_shared_info.
>>   */
>>  static struct page *__page_frag_cache_refill(struct page_frag_cache *nc,
>> +					     unsigned int fragsz,
>>  					     gfp_t gfp_mask)
>>  {
>>  	struct page *page = NULL;
>> @@ -5549,7 +5550,7 @@ static struct page *__page_frag_cache_refill(struct page_frag_cache *nc,
>>  				PAGE_FRAG_CACHE_MAX_ORDER);
>>  	nc->size = page ? PAGE_FRAG_CACHE_MAX_SIZE : PAGE_SIZE;
>>  #endif
>> -	if (unlikely(!page))
>> +	if (unlikely(!page && fragsz <= PAGE_SIZE))
>>  		page = alloc_pages_node(NUMA_NO_NODE, gfp, 0);
>>  
>>  	nc->va = page ? page_address(page) : NULL;
>> @@ -5576,7 +5577,7 @@ void *page_frag_alloc_align(struct page_frag_cache *nc,
>>  
>>  	if (unlikely(!nc->va)) {
>>  refill:
>> -		page = __page_frag_cache_refill(nc, gfp_mask);
>> +		page = __page_frag_cache_refill(nc, fragsz, gfp_mask);
>>  		if (!page)
>>  			return NULL;
>
>Oh, well, the reuse also needs an update. We can slap a similar
>condition next to the pfmemalloc check.

The sample code above cannot completely solve the current problem.
For example, when fragsz is greater than PAGE_FRAG_CACHE_MAX_SIZE(32768),
__page_frag_cache_refill will return a memory of only 32768 bytes, so 
should we continue to expand the PAGE_FRAG_CACHE_MAX_SIZE? Maybe more 
work needs to be done


  reply	other threads:[~2022-05-31 14:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1653752373-3172-1-git-send-email-chen45464546@163.com>
2022-05-29 23:30 ` [PATCH] mm: page_frag: Warn_on when frag_alloc size is bigger than PAGE_SIZE Andrew Morton
2022-05-30 13:39   ` [PATCH v2] " Chen Lin
2022-05-30 19:27     ` Jakub Kicinski
2022-05-30 19:29       ` Jakub Kicinski
2022-05-31 14:41         ` Chen Lin [this message]
2022-05-31 15:14           ` Jakub Kicinski
2022-05-31 15:36             ` Chen Lin
2022-05-31 15:47               ` Jakub Kicinski
2022-05-31 18:28                 ` Alexander Duyck
2022-06-01 12:32                   ` 愚树
2022-06-01 15:04                     ` Alexander Duyck
2022-07-06 15:21                       ` Maurizio Lombardi
2022-07-08  8:06                     ` Maurizio Lombardi
2022-05-30 20:07     ` Andrew Morton
2022-05-31 14:43       ` [PATCH v3] " Chen Lin
2022-05-31 23:45         ` Eric Dumazet

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=1654008072-3136-1-git-send-email-chen45464546@163.com \
    --to=chen45464546@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.duyck@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).