Re: Umem Questions

Dan Siemon <[email protected]>
Newsgroups org.kernel.vger.xdp-newbies
Message-ID <[email protected]>
> 
> Could you please check if this one fixes it for you?
> 
> diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
> index 56a28a686988..f01ef6bda390 100644
> --- a/net/xdp/xdp_umem.c
> +++ b/net/xdp/xdp_umem.c
> @@ -27,7 +27,7 @@ static void xdp_umem_unpin_pages(struct xdp_umem
> *umem)
>  {
>         unpin_user_pages_dirty_lock(umem->pgs, umem->npgs, true);
> 
> -       kfree(umem->pgs);
> +       kvfree(umem->pgs);
>         umem->pgs = NULL;
>  }
> 
> @@ -99,8 +99,7 @@ static int xdp_umem_pin_pages(struct xdp_umem
> *umem,
> unsigned long address)
>         long npgs;
>         int err;
> 
> -       umem->pgs = kcalloc(umem->npgs, sizeof(*umem->pgs),
> -                           GFP_KERNEL | __GFP_NOWARN);
> +       umem->pgs = kvcalloc(umem->npgs, sizeof(*umem->pgs),
> GFP_KERNEL | __GFP_NOWARN);
>         if (!umem->pgs)
>                 return -ENOMEM;
> 
> @@ -123,7 +122,7 @@ static int xdp_umem_pin_pages(struct xdp_umem
> *umem, unsigned long address)
>  out_pin:
>         xdp_umem_unpin_pages(umem);
>  out_pgs:
> -       kfree(umem->pgs);
> +       kvfree(umem->pgs);
>         umem->pgs = NULL;
>         return err;
>  }

Hi Magnus,

Thanks for looking at this. Yes, this patch allows me to create a much
larger Umem. I tried up to 32 GB.

I have not yet run any tests that extensively use the larger Umem.

Thanks again.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.