[PATCH net-next v17 11/14] mm: page_frag: add testing for the newly added prepare API

2024-09-02 Thread Yunsheng Lin
Add testing for the newly added prepare API, for both aligned and non-aligned API, also probe API is also tested along with prepare API. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- .../selftests/mm/page_frag/page_frag_test.c | 66 +-- tools/testing/selftests/mm

[PATCH net-next v17 04/14] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-09-02 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck Acked-by: Chuck Lever --- drivers/vhost/net.c | 2 +- include/linux/page_fr

[PATCH net-next v17 02/14] mm: move the page fragment allocator from page_alloc into its own file

2024-09-02 Thread Yunsheng Lin
1. https://lore.kernel.org/all/20230411160902.4134381-3-dhowe...@redhat.com/ 2. https://lore.kernel.org/all/15623dac-9358-4597-b3ee-3694a5956...@gmail.com/ 3. https://lore.kernel.org/all/CAKgT0UdH1yD=LSCXFJ=ym_aia4oomd-2wxyko42bizawmt_...@mail.gmail.com/ CC: David Howells CC: Alexander Duyck Signed-

[PATCH net-next v17 01/14] mm: page_frag: add a test module for page_frag

2024-09-02 Thread Yunsheng Lin
-off-by: Yunsheng Lin --- tools/testing/selftests/mm/Makefile | 3 + tools/testing/selftests/mm/page_frag/Makefile | 18 ++ .../selftests/mm/page_frag/page_frag_test.c | 170 + tools/testing/selftests/mm/run_vmtests.sh | 8 + tools/testing/selftests/mm

[PATCH net-next v16 11/14] mm: page_frag: add testing for the newly added prepare API

2024-08-30 Thread Yunsheng Lin
Add testing for the newly added prepare API, for both aligned and non-aligned API, also probe API is also tested along with prepare API. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- .../selftests/mm/page_frag/page_frag_test.c | 66 +-- tools/testing/selftests/mm

[PATCH net-next v16 04/14] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-08-30 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck Acked-by: Chuck Lever --- drivers/vhost/net.c | 2 +- include/linux/page_fr

[PATCH net-next v16 02/14] mm: move the page fragment allocator from page_alloc into its own file

2024-08-30 Thread Yunsheng Lin
1. https://lore.kernel.org/all/20230411160902.4134381-3-dhowe...@redhat.com/ 2. https://lore.kernel.org/all/15623dac-9358-4597-b3ee-3694a5956...@gmail.com/ 3. https://lore.kernel.org/all/CAKgT0UdH1yD=LSCXFJ=ym_aia4oomd-2wxyko42bizawmt_...@mail.gmail.com/ CC: David Howells CC: Alexander Duyck Signed-

[PATCH net-next v16 01/14] mm: page_frag: add a test module for page_frag

2024-08-30 Thread Yunsheng Lin
-off-by: Yunsheng Lin --- tools/testing/selftests/mm/Makefile | 2 + tools/testing/selftests/mm/page_frag/Makefile | 18 ++ .../selftests/mm/page_frag/page_frag_test.c | 170 ++ tools/testing/selftests/mm/run_vmtests.sh | 8 + tools/testing/selftests/mm

[PATCH net-next v15 04/13] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-08-26 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck Acked-by: Chuck Lever --- drivers/vhost/net.c | 2 +- include/linux/page_fr

[PATCH net-next v15 02/13] mm: move the page fragment allocator from page_alloc into its own file

2024-08-26 Thread Yunsheng Lin
1. https://lore.kernel.org/all/20230411160902.4134381-3-dhowe...@redhat.com/ 2. https://lore.kernel.org/all/15623dac-9358-4597-b3ee-3694a5956...@gmail.com/ 3. https://lore.kernel.org/all/CAKgT0UdH1yD=LSCXFJ=ym_aia4oomd-2wxyko42bizawmt_...@mail.gmail.com/ CC: David Howells CC: Alexander Duyck Signed-

[PATCH net-next v15 01/13] mm: page_frag: add a test module for page_frag

2024-08-26 Thread Yunsheng Lin
-off-by: Yunsheng Lin --- tools/testing/selftests/mm/Makefile | 2 + tools/testing/selftests/mm/page_frag/Makefile | 18 ++ .../selftests/mm/page_frag/page_frag_test.c | 170 ++ tools/testing/selftests/mm/run_vmtests.sh | 9 +- 4 files changed, 198 insertions

[PATCH net-next v14 04/11] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-08-23 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck Acked-by: Chuck Lever --- drivers/vhost/net.c | 2 +- include/linux/page_fr

[PATCH net-next v14 02/11] mm: move the page fragment allocator from page_alloc into its own file

2024-08-23 Thread Yunsheng Lin
1. https://lore.kernel.org/all/20230411160902.4134381-3-dhowe...@redhat.com/ 2. https://lore.kernel.org/all/15623dac-9358-4597-b3ee-3694a5956...@gmail.com/ 3. https://lore.kernel.org/all/CAKgT0UdH1yD=LSCXFJ=ym_aia4oomd-2wxyko42bizawmt_...@mail.gmail.com/ CC: David Howells CC: Alexander Duyck Signed-

[PATCH net-next v14 01/11] mm: page_frag: add a test module for page_frag

2024-08-23 Thread Yunsheng Lin
-off-by: Yunsheng Lin --- tools/testing/selftests/mm/Makefile | 2 + tools/testing/selftests/mm/page_frag/Makefile | 18 ++ .../selftests/mm/page_frag/page_frag_test.c | 170 ++ tools/testing/selftests/mm/run_vmtests.sh | 9 +- 4 files changed, 198 insertions

Re: [PATCH net-next v13 04/14] mm: page_frag: add '_va' suffix to page_frag API

2024-08-21 Thread Yunsheng Lin
On 2024/8/21 0:02, Alexander Duyck wrote: > On Tue, Aug 20, 2024 at 6:07 AM Yunsheng Lin wrote: >> >> On 2024/8/19 23:54, Alexander Duyck wrote: >> >> ... >> >>>>>> >>>>>> "There are three types of API as proposed in this

Re: [PATCH net-next v13 04/14] mm: page_frag: add '_va' suffix to page_frag API

2024-08-20 Thread Yunsheng Lin
On 2024/8/19 23:54, Alexander Duyck wrote: ... "There are three types of API as proposed in this patchset instead of two types of API: 1. page_frag_alloc_va() returns [va]. 2. page_frag_alloc_pg() returns [page, offset]. 3. page_frag_alloc() returns [va] & [page, off

Re: [PATCH net-next v13 04/14] mm: page_frag: add '_va' suffix to page_frag API

2024-08-16 Thread Yunsheng Lin
On 2024/8/15 23:00, Alexander Duyck wrote: > On Wed, Aug 14, 2024 at 8:00 PM Yunsheng Lin wrote: >> >> On 2024/8/14 23:49, Alexander H Duyck wrote: >>> On Thu, 2024-08-08 at 20:37 +0800, Yunsheng Lin wrote: >>>> Currently the page_frag API is returning 'vi

Re: [PATCH net-next v13 04/14] mm: page_frag: add '_va' suffix to page_frag API

2024-08-14 Thread Yunsheng Lin
On 2024/8/14 23:49, Alexander H Duyck wrote: > On Thu, 2024-08-08 at 20:37 +0800, Yunsheng Lin wrote: >> Currently the page_frag API is returning 'virtual address' >> or 'va' when allocing and expecting 'virtual address' or >> 'va' as

Re: [PATCH net-next v13 01/14] mm: page_frag: add a test module for page_frag

2024-08-09 Thread Yunsheng Lin
On 2024/8/9 19:08, Muhammad Usama Anjum wrote: > On 8/8/24 5:37 PM, Yunsheng Lin wrote: >> The testing is done by ensuring that the fragment allocated >> from a frag_frag_cache instance is pushed into a ptr_ring >> instance in a kthread binded to a specified cpu, and a k

[PATCH net-next v13 05/14] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-08-08 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck Acked-by: Chuck Lever --- drivers/vhost/net.c | 2 +- include/linux/page_fr

[PATCH net-next v13 04/14] mm: page_frag: add '_va' suffix to page_frag API

2024-08-08 Thread Yunsheng Lin
h va, page or both va and page may call page_frag_alloc_va*, page_frag_alloc_pg*, or page_frag_alloc* API accordingly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin Reviewed-by: Subbaraya Sundeep Acked-by: Chuck Lever Acked-by: Sagi Grimberg --- drivers/net/ethernet/google/gve/gve_rx.c

[PATCH net-next v13 02/14] mm: move the page fragment allocator from page_alloc into its own file

2024-08-08 Thread Yunsheng Lin
1. https://lore.kernel.org/all/20230411160902.4134381-3-dhowe...@redhat.com/ 2. https://lore.kernel.org/all/15623dac-9358-4597-b3ee-3694a5956...@gmail.com/ 3. https://lore.kernel.org/all/CAKgT0UdH1yD=LSCXFJ=ym_aia4oomd-2wxyko42bizawmt_...@mail.gmail.com/ CC: David Howells CC: Alexander Duyck Signed-off-

[PATCH net-next v13 01/14] mm: page_frag: add a test module for page_frag

2024-08-08 Thread Yunsheng Lin
-off-by: Yunsheng Lin --- tools/testing/selftests/mm/Makefile | 2 + tools/testing/selftests/mm/page_frag/Makefile | 18 ++ .../selftests/mm/page_frag/page_frag_test.c | 170 ++ tools/testing/selftests/mm/run_vmtests.sh | 9 +- 4 files changed, 198 insertions

Re: [RFC PATCH net-next v6 00/15] Device Memory TCP

2024-03-26 Thread Yunsheng Lin
On 2024/3/26 8:28, Mina Almasry wrote: > On Tue, Mar 5, 2024 at 11:38 AM Mina Almasry wrote: >> >> On Tue, Mar 5, 2024 at 4:54 AM Yunsheng Lin wrote: >>> >>> On 2024/3/5 10:01, Mina Almasry wrote: >>> >&g

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-07 Thread Yunsheng Lin
On 2024/3/7 6:10, Mina Almasry wrote: ... > +static int netdev_restart_rx_queue(struct net_device *dev, int rxq_idx) > +{ > + void *new_mem; > + void *old_mem; > + int err; > + > + if (!dev || !dev->netdev_ops) > + return -EINVAL; >

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-06 Thread Yunsheng Lin
On 2024/3/6 5:17, Mina Almasry wrote: > On Tue, Mar 5, 2024 at 4:55 AM Yunsheng Lin wrote: >> >> On 2024/3/5 10:01, Mina Almasry wrote: >> >> ... >> >>> >>> The netdev_dmabuf_binding struct is refcounted, and releases its >>> resource

Re: [RFC PATCH net-next v6 00/15] Device Memory TCP

2024-03-06 Thread Yunsheng Lin
On 2024/3/6 3:38, Mina Almasry wrote: > On Tue, Mar 5, 2024 at 4:54 AM Yunsheng Lin wrote: >> >> On 2024/3/5 10:01, Mina Almasry wrote: >> >> ... >> >>> >>> Perf - page-pool benchmark: >>> --- >>&g

Re: [RFC PATCH net-next v6 05/15] netdev: support binding dma-buf to netdevice

2024-03-05 Thread Yunsheng Lin
On 2024/3/5 10:01, Mina Almasry wrote: ... > > The netdev_dmabuf_binding struct is refcounted, and releases its > resources only when all the refs are released. > > Signed-off-by: Willem de Bruijn > Signed-off-by: Kaiyuan Zhang > Signed-off-by: Mina Almasry > > --- > > RFC v6: > - Validate

Re: [RFC PATCH net-next v6 03/15] net: page_pool: factor out page_pool recycle check

2024-03-05 Thread Yunsheng Lin
On 2024/3/5 10:01, Mina Almasry wrote: > The check is duplicated in 2 places, factor it out into a common helper. Reviewed-by: Yunsheng Lin

Re: [RFC PATCH net-next v6 00/15] Device Memory TCP

2024-03-05 Thread Yunsheng Lin
On 2024/3/5 10:01, Mina Almasry wrote: ... > > Perf - page-pool benchmark: > --- > > bench_page_pool_simple.ko tests with and without these changes: > https://pastebin.com/raw/ncHDwAbn > > AFAIK the number that really matters in the perf tests is the > 'tasklet_page_poo

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-13 Thread Yunsheng Lin
On 2023/12/12 22:28, Mina Almasry wrote: ... >> >> the page_ref_*() API may be avoided using the below patch: >> https://patchwork.kernel.org/project/netdevbpf/patch/20231113130041.58124-7-linyunsh...@huawei.com/ >> > > Even after the patch above, you're still calling page_ref_count() in > the p

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-12 Thread Yunsheng Lin
On 2023/12/12 2:14, Mina Almasry wrote: > On Mon, Dec 11, 2023 at 3:51 AM Yunsheng Lin wrote: >> >> On 2023/12/11 12:04, Mina Almasry wrote: >>> On Sun, Dec 10, 2023 at 6:26 PM Mina Almasry wrote: >>>> >>>> On Sun, Dec 10, 2023 at 6:04 PM Yunsheng

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-11 Thread Yunsheng Lin
On 2023/12/11 12:04, Mina Almasry wrote: > On Sun, Dec 10, 2023 at 6:26 PM Mina Almasry wrote: >> >> On Sun, Dec 10, 2023 at 6:04 PM Yunsheng Lin wrote: >>> >>> On 2023/12/9 0:05, Mina Almasry wrote: >>>> On Fri, Dec 8, 2023 at 1:30 AM Yunsheng Lin

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-10 Thread Yunsheng Lin
On 2023/12/9 0:05, Mina Almasry wrote: > On Fri, Dec 8, 2023 at 1:30 AM Yunsheng Lin wrote: >> >> >> As mentioned before, it seems we need to have the above checking every >> time we need to do some per-page handling in page_pool core, is there >> a plan in your

Re: [net-next v1 09/16] page_pool: device memory support

2023-12-08 Thread Yunsheng Lin
On 2023/12/8 8:52, Mina Almasry wrote: > Overload the LSB of struct page* to indicate that it's a page_pool_iov. > > Refactor mm calls on struct page* into helpers, and add page_pool_iov > handling on those helpers. Modify callers of these mm APIs with calls to > these helpers instead. > > In are

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-10 Thread Yunsheng Lin
teration. >> > > That is just a mistake, sorry. Will remove this increment. You seems to be combining comments in different thread and replying in one thread, I am not sure that is a good practice and I almost missed the reply below as I don't seem to be cc'ed. &

Re: [RFC PATCH v3 07/12] page-pool: device memory support

2023-11-09 Thread Yunsheng Lin
On 2023/11/9 20:20, Mina Almasry wrote: > On Thu, Nov 9, 2023 at 1:30 AM Yunsheng Lin wrote: >> >> On 2023/11/9 11:20, Mina Almasry wrote: >>> On Wed, Nov 8, 2023 at 2:56 AM Yunsheng Lin wrote: >> >>> >>> Agreed everything above is undoable. >&g

Re: [RFC PATCH v3 07/12] page-pool: device memory support

2023-11-09 Thread Yunsheng Lin
On 2023/11/9 11:20, Mina Almasry wrote: > On Wed, Nov 8, 2023 at 2:56 AM Yunsheng Lin wrote: > > Agreed everything above is undoable. > >> But we might be able to do something as folio is doing now, mm subsystem >> is still seeing 'struct folio/page', but

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-09 Thread Yunsheng Lin
On 2023/11/9 10:22, Mina Almasry wrote: > On Tue, Nov 7, 2023 at 7:40 PM Yunsheng Lin wrote: >> >> On 2023/11/8 5:59, Mina Almasry wrote: >>> On Mon, Nov 6, 2023 at 11:46 PM Yunsheng Lin wrote: >>>> >>>> On 2023/11/6 10:44, Mina Almasry wrote:

Re: [RFC PATCH v3 08/12] net: support non paged skb frags

2023-11-08 Thread Yunsheng Lin
On 2023/11/8 5:19, Mina Almasry wrote: >> >> > > My personal immediate reaction is that this may just introduce code > churn without significant benefit. If an unsuspecting caller call > skb_frag_page() on devmem frag and doesn't correctly handle NULL > return, it will crash or error out anyway, a

Re: [RFC PATCH v3 07/12] page-pool: device memory support

2023-11-08 Thread Yunsheng Lin
On 2023/11/8 5:56, Mina Almasry wrote: > On Tue, Nov 7, 2023 at 12:00 AM Yunsheng Lin wrote: >> >> On 2023/11/6 10:44, Mina Almasry wrote: >>> Overload the LSB of struct page* to indicate that it's a page_pool_iov. >>> >>> Refactor mm calls on s

Re: [RFC PATCH v3 05/12] netdev: netdevice devmem allocator

2023-11-07 Thread Yunsheng Lin
is device memory. >> > > In my limited experience dma-buf is generally device memory, and > that's really its use case. CONFIG_UDMABUF is a driver that mocks > dma-buf with a memfd which I think is used for testing. But I can do > the rename, it's more clear

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-07 Thread Yunsheng Lin
On 2023/11/8 5:59, Mina Almasry wrote: > On Mon, Nov 6, 2023 at 11:46 PM Yunsheng Lin wrote: >> >> On 2023/11/6 10:44, Mina Almasry wrote: >>> + >>> +void __netdev_devmem_binding_free(struct netdev_dmabuf_binding *binding) &g

Re: [RFC PATCH v3 08/12] net: support non paged skb frags

2023-11-07 Thread Yunsheng Lin
On 2023/11/6 10:44, Mina Almasry wrote: > Make skb_frag_page() fail in the case where the frag is not backed > by a page, and fix its relevent callers to handle this case. > > Correctly handle skb_frag refcounting in the page_pool_iovs case. > > Signed-off-by: Mina Almasry > ... > /** > *

Re: [RFC PATCH v3 07/12] page-pool: device memory support

2023-11-07 Thread Yunsheng Lin
On 2023/11/6 10:44, Mina Almasry wrote: > Overload the LSB of struct page* to indicate that it's a page_pool_iov. > > Refactor mm calls on struct page* into helpers, and add page_pool_iov > handling on those helpers. Modify callers of these mm APIs with calls to > these helpers instead. > > In ar

Re: [RFC PATCH v3 04/12] netdev: support binding dma-buf to netdevice

2023-11-06 Thread Yunsheng Lin
On 2023/11/6 10:44, Mina Almasry wrote: > + > +void __netdev_devmem_binding_free(struct netdev_dmabuf_binding *binding) > +{ > + size_t size, avail; > + > + gen_pool_for_each_chunk(binding->chunk_pool, > + netdev_devmem_free_chunk_owner, NULL); > + > + size =

Re: [RFC PATCH v3 05/12] netdev: netdevice devmem allocator

2023-11-06 Thread Yunsheng Lin
On 2023/11/6 10:44, Mina Almasry wrote: > + > +void netdev_free_devmem(struct page_pool_iov *ppiov) > +{ > + struct netdev_dmabuf_binding *binding = page_pool_iov_binding(ppiov); > + > + refcount_set(&ppiov->refcount, 1); > + > + if (gen_pool_has_addr(binding->chunk_pool, > +

Re: [RFC PATCH v3 02/12] net: page_pool: create hooks for custom page providers

2023-11-06 Thread Yunsheng Lin
On 2023/11/6 10:44, Mina Almasry wrote: > > diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h > index 6fc5134095ed..d4bea053bb7e 100644 > --- a/include/net/page_pool/types.h > +++ b/include/net/page_pool/types.h > @@ -60,6 +60,8 @@ struct page_pool_params { > int