Linux 9p file system development
 help / color / mirror / Atom feed
From: Christian Schoenebeck <linux_oss@crudebyte.com>
To: v9fs@lists.linux.dev, Pierre Barre <pierre@barre.sh>
Cc: ericvh@kernel.org, lucho@ionkov.net, asmadeus@codewreck.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 9p: Use kvmalloc for message buffers
Date: Wed, 30 Jul 2025 18:08:13 +0200	[thread overview]
Message-ID: <2989343.ydHz1Oe0dO@silver> (raw)
In-Reply-To: <1fb9c439-73f3-4a00-8a8b-45eeb85883eb@app.fastmail.com>

On Wednesday, July 30, 2025 5:08:05 PM CEST Pierre Barre wrote:
> While developing a 9P server (https://github.com/Barre/ZeroFS) and testing it under high-load, I was running into allocation failures. The failures occur even with plenty of free memory available because kmalloc requires contiguous physical memory.
> 
> This results in errors like:
> ls: page allocation failure: order:7, mode:0x40c40(GFP_NOFS|__GFP_COMP)

What was msize?

> Signed-off-by: Pierre Barre <pierre@barre.sh>
> ---
>  net/9p/client.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/9p/client.c b/net/9p/client.c
> index 5c1ca57ccd28..f82b5674057c 100644
> --- a/net/9p/client.c
> +++ b/net/9p/client.c
> @@ -230,7 +230,7 @@ static int p9_fcall_init(struct p9_client *c, struct p9_fcall *fc,
>  		fc->sdata = kmem_cache_alloc(c->fcall_cache, GFP_NOFS);
>  		fc->cache = c->fcall_cache;
>  	} else {
> -		fc->sdata = kmalloc(alloc_msize, GFP_NOFS);
> +		fc->sdata = kvmalloc(alloc_msize, GFP_NOFS);

That would work with certain transports like fd I guess, but not via
virtio-pci transport for instance, since PCI-DMA requires physical pages. Same
applies to Xen transport I guess.

>  		fc->cache = NULL;
>  	}
>  	if (!fc->sdata)
> @@ -252,7 +252,7 @@ void p9_fcall_fini(struct p9_fcall *fc)
>  	if (fc->cache)
>  		kmem_cache_free(fc->cache, fc->sdata);
>  	else
> -		kfree(fc->sdata);
> +		kvfree(fc->sdata);
>  }
>  EXPORT_SYMBOL(p9_fcall_fini);
>  
> 



  reply	other threads:[~2025-07-30 16:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 15:08 [PATCH] 9p: Use kvmalloc for message buffers Pierre Barre
2025-07-30 16:08 ` Christian Schoenebeck [this message]
2025-07-30 16:19   ` Pierre Barre
2025-07-30 17:28     ` Christian Schoenebeck
2025-07-30 20:16       ` Pierre Barre
2025-07-30 22:07         ` asmadeus
2025-07-31  0:36           ` Pierre Barre
2025-08-06 15:50             ` Pierre Barre
2025-08-06 21:44               ` Dominique Martinet
2025-08-08 11:12                 ` Christian Schoenebeck
2025-10-16  7:01                   ` [PATCH v2] 9p: Use kvmalloc for message buffers on supported transports Pierre Barre
2025-10-16  7:26                     ` Dominique Martinet
2025-10-16 13:06                     ` Christian Schoenebeck
2025-10-16 13:58                       ` [PATCH v3] " Pierre Barre
2025-10-17  5:49                         ` Christophe JAILLET
2025-11-03  7:52                         ` asmadeus
2025-11-03 10:16                           ` Pierre Barre

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=2989343.ydHz1Oe0dO@silver \
    --to=linux_oss@crudebyte.com \
    --cc=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=pierre@barre.sh \
    --cc=v9fs@lists.linux.dev \
    /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