Re: [PATCH net-next] page_pool: add a test module for page_pool

2024-09-11 Thread Yunsheng Lin
On 2024/9/10 19:27, Jesper Dangaard Brouer wrote: ... >> >> The main issue I remembered was that it only support x86:( >> > > Yes, because I've added ASM code for reading TSC counter in a very > precise manor. Given we run many iterations, then I don't think we > need this precise reading.  I gue

Re: [PATCH net-next] page_pool: add a test module for page_pool

2024-09-10 Thread Yunsheng Lin
On 2024/9/10 1:28, Mina Almasry wrote: > On Mon, Sep 9, 2024 at 2:25 AM Yunsheng Lin wrote: >> >> The testing is done by ensuring that the page allocated from >> the page_pool instance is pushed into a ptr_ring instance in >> a kthread/napi binded to a specified cpu, a

[PATCH net-next] page_pool: add a test module for page_pool

2024-09-09 Thread Yunsheng Lin
: Yunsheng Lin --- tools/testing/selftests/net/Makefile | 3 + .../testing/selftests/net/page_pool/Makefile | 18 + .../selftests/net/page_pool/page_pool_test.c | 433 ++ tools/testing/selftests/net/test_page_pool.sh | 175 +++ 4 files changed, 629 insertions

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

2024-09-06 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 v18 04/14] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-09-06 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 v18 02/14] mm: move the page fragment allocator from page_alloc into its own file

2024-09-06 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 v18 01/14] mm: page_frag: add a test module for page_frag

2024-09-06 Thread Yunsheng Lin
-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck --- 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

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

2024-08-06 Thread Yunsheng Lin
On 2024/8/6 8:52, Alexander Duyck wrote: > On Sun, Aug 4, 2024 at 10:00 AM Yunsheng Lin > wrote: >> >> On 8/3/2024 1:00 AM, Alexander Duyck wrote: >> >>>> >>>>> >>>>> As far as your API extension and naming maybe you should look

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

2024-08-03 Thread Yunsheng Lin
On 8/3/2024 1:00 AM, Alexander Duyck wrote: As far as your API extension and naming maybe you should look like something like bio_vec and borrow the naming from that since that is essentially what you are passing back and forth is essentially that instead of a page frag which is normally a vi

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

2024-08-02 Thread Yunsheng Lin
On 2024/8/1 23:21, Alexander Duyck wrote: > On Thu, Aug 1, 2024 at 6:01 AM Yunsheng Lin wrote: >> >> On 2024/8/1 2:13, Alexander Duyck wrote: >>> On Wed, Jul 31, 2024 at 5:50 AM Yunsheng Lin wrote: >>>> >>>> Currently the page_frag API is return

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

2024-08-01 Thread Yunsheng Lin
On 2024/8/1 2:13, Alexander Duyck wrote: > On Wed, Jul 31, 2024 at 5:50 AM Yunsheng Lin wrote: >> >> Currently the page_frag API is returning 'virtual address' >> or 'va' when allocing and expecting 'virtual address' or >> 'va' as

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

2024-07-31 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 --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c

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

2024-07-31 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 --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_t

Re: [RFC v11 04/14] mm: page_frag: add '_va' suffix to page_frag API

2024-07-25 Thread Yunsheng Lin
On 2024/7/22 4:41, Alexander Duyck wrote: > On Fri, Jul 19, 2024 at 2:37 AM Yunsheng Lin wrote: >> >> Currently the page_frag API is returning 'virtual address' >> or 'va' when allocing and expecting 'virtual address' or >> 'va&#x

[RFC v11 05/14] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-07-19 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/cor

[RFC v11 04/14] mm: page_frag: add '_va' suffix to page_frag API

2024-07-19 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 --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_t

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

2024-07-09 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/cor

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

2024-07-09 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 --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drive

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

2024-06-25 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/cor

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

2024-06-25 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 --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drive

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

2024-06-17 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/cor

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

2024-06-17 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 --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drive

[PATCH net-next v7 07/15] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-06-07 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/cor

[PATCH net-next v7 06/15] mm: page_frag: add '_va' suffix to page_frag API

2024-06-07 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 --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drive

[PATCH net-next v6 06/15] mm: page_frag: add '_va' suffix to page_frag API

2024-06-05 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 --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drive

[PATCH net-next v6 07/15] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-06-05 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/cor

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

2024-05-28 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/cor

[PATCH net-next v5 06/13] mm: page_frag: add '_va' suffix to page_frag API

2024-05-28 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 --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drive

[RFC v4 06/13] mm: page_frag: add '_va' suffix to page_frag API

2024-05-15 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 --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drive

[RFC v4 07/13] mm: page_frag: avoid caller accessing 'page_frag_cache' directly

2024-05-15 Thread Yunsheng Lin
Use appropriate frag_page API instead of caller accessing 'page_frag_cache' directly. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/cor

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

2024-05-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 --- drivers/vhost/net.c | 2 +- include/linux/page_frag_cache.h | 10 ++ mm/page_frag_test.c | 2 +- net/cor

[PATCH net-next v3 06/13] mm: page_frag: add '_va' suffix to page_frag API

2024-05-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 --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drive

Re: [PATCH net-next v2 07/15] mm: page_frag: add '_va' suffix to page_frag API

2024-04-17 Thread Yunsheng Lin
On 2024/4/17 0:12, Alexander H Duyck wrote: > On Mon, 2024-04-15 at 21:19 +0800, Yunsheng Lin wrote: >> Currently most of the API for page_frag API is returning >> 'virtual address' as output or expecting 'virtual address' >> as input, in order to different

[PATCH net-next v2 07/15] mm: page_frag: add '_va' suffix to page_frag API

2024-04-15 Thread Yunsheng Lin
ding API mirroring the page_pool_alloc_va() API of the page_pool. Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/

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

2024-04-07 Thread Yunsheng Lin
ding API mirroring the page_pool_alloc_va() API of the page_pool. Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/

[PATCH RFC 04/10] mm: page_frag: add '_va' suffix to page_frag API

2024-03-28 Thread Yunsheng Lin
ding API mirroring the page_pool_alloc_va() API of the page_pool. Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_rx.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +- drivers/net/ethernet/intel/

[PATCH net-next v6 4/5] vhost/net: remove vhost_net_page_frag_refill()

2024-02-28 Thread Yunsheng Lin
uct page_frag', and allocating frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin

[PATCH net-next v6 5/5] tools: virtio: introduce vhost_net_test

2024-02-28 Thread Yunsheng Lin
. Steps for vhost_net rx testing: 1. Prepare a in buf. 2. Do the sending in the tun side. 3. Kick the vhost_net to do rx processing. 4. verify the data received by vhost_net is correct. Signed-off-by: Yunsheng Lin --- tools/virtio/.gitignore| 1 + tools/virtio/Makefile

[PATCH net-next v6 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-02-28 Thread Yunsheng Lin
g for page frag implementation in sock.c for now as suggested by Paolo Abeni. Signed-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck CC: Alexander Duyck --- drivers/vhost/net.c | 2 +- mm/page_alloc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/net.c

Re: [PATCH net-next v5 5/5] tools: virtio: introduce vhost_net_test

2024-02-05 Thread Yunsheng Lin
On 2024/2/6 11:08, Jason Wang wrote: ... >> + >> +static void wait_for_interrupt(struct vq_info *vq) >> +{ >> + unsigned long long val; >> + >> + poll(&vq->fds, 1, -1); > > It's not good to wait indefinitely. How about a timeout value of 100ms as below? poll(&vq->fds, 1, 100); > >

[PATCH net-next v5 5/5] tools: virtio: introduce vhost_net_test

2024-02-05 Thread Yunsheng Lin
. Steps for vhost_net rx testing: 1. Prepare a in buf. 2. Do the sending in the tun side. 3. Kick the vhost_net to do rx processing. 4. verify the data received by vhost_net is correct. Signed-off-by: Yunsheng Lin --- tools/virtio/.gitignore| 1 + tools/virtio/Makefile

[PATCH net-next v5 4/5] vhost/net: remove vhost_net_page_frag_refill()

2024-02-05 Thread Yunsheng Lin
uct page_frag', and allocating frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin

[PATCH net-next v5 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-02-05 Thread Yunsheng Lin
g for page frag implementation in sock.c for now as suggested by Paolo Abeni. Signed-off-by: Yunsheng Lin Reviewed-by: Alexander Duyck CC: Alexander Duyck --- drivers/vhost/net.c | 2 +- mm/page_alloc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/net.c

Re: [PATCH net-next v4 5/5] tools: virtio: introduce vhost_net_test

2024-02-03 Thread Yunsheng Lin
On 2024/2/4 9:30, Jason Wang wrote: > On Fri, Feb 2, 2024 at 8:24 PM Yunsheng Lin wrote: >> >> On 2024/2/2 12:05, Jason Wang wrote: >>> On Tue, Jan 30, 2024 at 7:38 PM Yunsheng Lin wrote: >>>> >>>> introduce vhost_net_test basing on virtio_te

Re: [PATCH net-next v4 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-02-02 Thread Yunsheng Lin
On 2024/2/2 16:36, Paolo Abeni wrote: > On Fri, 2024-02-02 at 10:10 +0800, Yunsheng Lin wrote: >> On 2024/2/1 21:16, Paolo Abeni wrote: >> >>> from the __page_frag_cache_refill() allocator - which never accesses >>> the memory reserves. >> >> I am n

Re: [PATCH net-next v4 5/5] tools: virtio: introduce vhost_net_test

2024-02-02 Thread Yunsheng Lin
On 2024/2/2 12:05, Jason Wang wrote: > On Tue, Jan 30, 2024 at 7:38 PM Yunsheng Lin wrote: >> >> introduce vhost_net_test basing on virtio_test to test >> vhost_net changing in the kernel. > > Let's describe what kind of test is being done and how it is done here.

Re: [PATCH net-next v4 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-02-01 Thread Yunsheng Lin
On 2024/2/1 21:16, Paolo Abeni wrote: > On Tue, 2024-01-30 at 19:37 +0800, Yunsheng Lin wrote: >> Currently there seems to be three page frag implementions >> which all try to allocate order 3 page, if that fails, it >> then fail back to allocate order 0 page, and each of them

[PATCH net-next v4 5/5] tools: virtio: introduce vhost_net_test

2024-01-30 Thread Yunsheng Lin
introduce vhost_net_test basing on virtio_test to test vhost_net changing in the kernel. Signed-off-by: Yunsheng Lin --- tools/virtio/.gitignore | 1 + tools/virtio/Makefile | 8 +- tools/virtio/vhost_net_test.c | 576 ++ 3 files changed, 582

[PATCH net-next v4 4/5] vhost/net: remove vhost_net_page_frag_refill()

2024-01-30 Thread Yunsheng Lin
uct page_frag', and allocating frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin

[PATCH net-next v4 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-01-30 Thread Yunsheng Lin
(), but it is not masked off in __page_frag_cache_refill(). This patch unifies the gfp bits used between different implementions by or'ing __GFP_NOMEMALLOC and masking off __GFP_DIRECT_RECLAIM for order 3 page allocation to avoid possible pressure for mm. Signed-off-by: Yunsheng Lin Reviewe

[PATCH net-next v3 5/5] tools: virtio: introduce vhost_net_test

2024-01-23 Thread Yunsheng Lin
introduce vhost_net_test basing on virtio_test to test vhost_net changing in the kernel. Signed-off-by: Yunsheng Lin --- tools/virtio/.gitignore | 1 + tools/virtio/Makefile | 8 +- tools/virtio/vhost_net_test.c | 576 ++ 3 files changed, 582

[PATCH net-next v3 4/5] vhost/net: remove vhost_net_page_frag_refill()

2024-01-23 Thread Yunsheng Lin
uct page_frag', and allocating frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin

[PATCH net-next v3 2/5] page_frag: unify gfp bits for order 3 page allocation

2024-01-23 Thread Yunsheng Lin
(), but it is not masked off in __page_frag_cache_refill(). This patch unifies the gfp bits used between different implementions by or'ing __GFP_NOMEMALLOC and masking off __GFP_DIRECT_RECLAIM for order 3 page allocation to avoid possible pressure for mm. Signed-off-by: Yunsheng Lin Reviewe

Re: [PATCH net-next 4/6] vhost/net: remove vhost_net_page_frag_refill()

2024-01-08 Thread Yunsheng Lin
On 2024/1/6 0:06, Alexander H Duyck wrote: >> >> static void handle_tx_copy(struct vhost_net *net, struct socket *sock) >> @@ -1353,8 +1318,7 @@ static int vhost_net_open(struct inode *inode, struct >> file *f) >> vqs[VHOST_NET_VQ_RX]); >> >> f->private_data = n; >>

Re: [PATCH net-next 2/6] page_frag: unify gfp bits for order 3 page allocation

2024-01-08 Thread Yunsheng Lin
On 2024/1/5 23:35, Alexander H Duyck wrote: > On Wed, 2024-01-03 at 17:56 +0800, Yunsheng Lin wrote: >> Currently there seems to be three page frag implementions >> which all try to allocate order 3 page, if that fails, it >> then fail back to allocate order 0 page, and each

Re: [PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2024-01-04 Thread Yunsheng Lin
On 2024/1/5 0:17, Eugenio Perez Martin wrote: > On Wed, Jan 3, 2024 at 11:00 AM Yunsheng Lin wrote: ... >> + >> +static void run_tx_test(struct vdev_info *dev, struct vq_info *vq, >> + bool delayed, int batch, int bufs) >> +{ >> +

[PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2024-01-03 Thread Yunsheng Lin
introduce vhost_net_test basing on virtio_test to test vhost_net changing in the kernel. Signed-off-by: Yunsheng Lin --- tools/virtio/Makefile | 8 +- tools/virtio/vhost_net_test.c | 574 ++ 2 files changed, 579 insertions(+), 3 deletions(-) create

[PATCH net-next 5/6] net: introduce page_frag_cache_drain()

2024-01-03 Thread Yunsheng Lin
When draining a page_frag_cache, most user are doing the similar steps, so introduce an API to avoid code duplication. Signed-off-by: Yunsheng Lin Acked-by: Jason Wang --- drivers/net/ethernet/google/gve/gve_main.c | 11 ++- drivers/net/ethernet/mediatek/mtk_wed_wo.c | 17

[PATCH net-next 4/6] vhost/net: remove vhost_net_page_frag_refill()

2024-01-03 Thread Yunsheng Lin
uct page_frag', and allocating frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng Lin

[PATCH net-next 2/6] page_frag: unify gfp bits for order 3 page allocation

2024-01-03 Thread Yunsheng Lin
(), but it is not masked off in __page_frag_cache_refill(). This patch unifies the gfp bits used between different implementions by or'ing __GFP_NOMEMALLOC and masking off __GFP_DIRECT_RECLAIM for order 3 page allocation to avoid possible pressure for mm. Signed-off-by: Yunsheng Lin CC:

Re: [PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2023-12-20 Thread Yunsheng Lin
On 2023/12/21 10:33, Jason Wang wrote: > On Wed, Dec 20, 2023 at 8:45 PM Yunsheng Lin wrote: >> >> On 2023/12/12 12:35, Jason Wang wrote:>>>> +done: >>>>>> + backend.fd = tun_alloc(); >>>>>> + assert

Re: [PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2023-12-20 Thread Yunsheng Lin
On 2023/12/12 12:35, Jason Wang wrote: +done: + backend.fd = tun_alloc(); + assert(backend.fd >= 0); + vdev_info_init(&dev, features); + vq_info_add(&dev, 256); + run_test(&dev, &dev.vqs[0], delayed, batch, reset, nbufs); >>> >>> I'd expect

Re: [PATCH net-next v2 3/3] net: add netmem_t to skb_frag_t

2023-12-18 Thread Yunsheng Lin
On 2023/12/17 16:09, Mina Almasry wrote: > Use netmem_t instead of page directly in skb_frag_t. Currently netmem_t > is always a struct page underneath, but the abstraction allows efforts > to add support for skb frags not backed by pages. > > There is unfortunately 1 instance where the skb_frag_t

Re: [PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2023-12-07 Thread Yunsheng Lin
On 2023/12/7 14:00, Jason Wang wrote: > On Tue, Dec 5, 2023 at 7:35 PM Yunsheng Lin wrote: ... >> + >> +static int tun_alloc(void) >> +{ >> + struct ifreq ifr; >> + int fd, e; >> + >> + fd = open("/dev/net/tun", O_RD

Re: [PATCH net-next 2/6] page_frag: unify gfp bit for order 3 page allocation

2023-12-07 Thread Yunsheng Lin
On 2023/12/7 11:15, Jakub Kicinski wrote: > On Tue, 5 Dec 2023 19:34:40 +0800 Yunsheng Lin wrote: >> __GFP_DIRECT_RECLAIM is xor'd to avoid >> direct reclaim in skb_page_frag_refill(), but it is not >> xor'd in __page_frag_cache_refill(). > > xor is not the

[PATCH net-next 6/6] tools: virtio: introduce vhost_net_test

2023-12-05 Thread Yunsheng Lin
introduce vhost_net_test basing on virtio_test to test vhost_net changing in the kernel. Signed-off-by: Yunsheng Lin --- tools/virtio/Makefile | 8 +- tools/virtio/vhost_net_test.c | 441 ++ 2 files changed, 446 insertions(+), 3 deletions(-) create

[PATCH net-next 5/6] net: introduce page_frag_cache_drain()

2023-12-05 Thread Yunsheng Lin
When draining a page_frag_cache, most user are doing the similar steps, so introduce an API to avoid code duplication. Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_main.c | 11 ++- drivers/net/ethernet/mediatek/mtk_wed_wo.c | 17 ++--- drivers/nvme

[PATCH net-next 4/6] vhost/net: remove vhost_net_page_frag_refill()

2023-12-05 Thread Yunsheng Lin
uct page_frag', and allocating frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng

[PATCH net-next 2/6] page_frag: unify gfp bit for order 3 page allocation

2023-12-05 Thread Yunsheng Lin
, but it is not xor'd in __page_frag_cache_refill(). This patch unifies the gfp bits used between different implementions by or'ing __GFP_NOMEMALLOC and xor'ing __GFP_DIRECT_RECLAIM for order 3 page allocation to avoid possible pressure for mm. Signed-off-by: Yunsheng Lin CC: Alexa

[PATCH RFC 5/6] net: introduce page_frag_cache_drain()

2023-12-01 Thread Yunsheng Lin
When draining a page_frag_cache, most user are doing the similar steps, so introduce an API to avoid code duplication. Signed-off-by: Yunsheng Lin --- drivers/net/ethernet/google/gve/gve_main.c | 11 ++- drivers/net/ethernet/mediatek/mtk_wed_wo.c | 17 ++--- drivers/nvme

[PATCH RFC 6/6] tools: virtio: introduce vhost_net_test

2023-12-01 Thread Yunsheng Lin
introduce vhost_net_test basing on virtio_test to test vhost_net changing in the kernel. Signed-off-by: Yunsheng Lin --- tools/virtio/Makefile | 8 +- tools/virtio/vhost_net_test.c | 441 ++ 2 files changed, 446 insertions(+), 3 deletions(-) create

[PATCH RFC 4/6] vhost/net: remove vhost_net_page_frag_refill()

2023-12-01 Thread Yunsheng Lin
uct page_frag', and allocating frag using page_frag_alloc_align(). The added benefit is that not only unifying the page frag implementation a little, but also having about 0.5% performance boost testing by using the vhost_net_test introduced in the last patch. Signed-off-by: Yunsheng

[PATCH RFC 2/6] page_frag: unify gfp bit for order 3 page allocation

2023-12-01 Thread Yunsheng Lin
, but it is not xor'd in __page_frag_cache_refill(). This patch unifies the gfp bits used between different implementions by or'ing __GFP_NOMEMALLOC and xor'ing __GFP_DIRECT_RECLAIM for order 3 page allocation to avoid possible pressure for mm. Signed-off-by: Yunsheng Lin CC: Alexa

Re: [PATCH net v4 1/2] net: sched: fix packet stuck problem for lockless qdisc

2021-04-19 Thread Yunsheng Lin
On 2021/4/20 7:55, Michal Kubecek wrote: > On Mon, Apr 19, 2021 at 05:29:46PM +0200, Michal Kubecek wrote: >> >> As pointed out in the discussion on v3, this patch may result in >> significantly higher CPU consumption with multiple threads competing on >> a saturated outgoing device. I missed this

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-19 Thread Yunsheng Lin
On 2021/4/19 22:57, Michal Kubecek wrote: > On Mon, Apr 19, 2021 at 10:04:27AM +0800, Yunsheng Lin wrote: >>> >>> I tried this patch o top of 5.12-rc7 with real devices. I used two >>> machines with 10Gb/s Intel ixgbe NICs, sender has 16 CPUs (2 8-core CPUs >

Re: [Linuxarm] Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-19 Thread Yunsheng Lin
On 2021/4/19 10:04, Yunsheng Lin wrote: > On 2021/4/19 6:59, Michal Kubecek wrote: >> On Thu, Mar 25, 2021 at 11:13:11AM +0800, Yunsheng Lin wrote: >>> Lockless qdisc has below concurrent problem: >>> cpu0 cpu1 >>> .

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-18 Thread Yunsheng Lin
On 2021/4/19 6:59, Michal Kubecek wrote: > On Thu, Mar 25, 2021 at 11:13:11AM +0800, Yunsheng Lin wrote: >> Lockless qdisc has below concurrent problem: >> cpu0 cpu1 >> .

Re: [PATCH net] net: fix use-after-free when UDP GRO with shared fraglist

2021-04-16 Thread Yunsheng Lin
On 2021/1/6 11:32, Dongseok Yi wrote: > On 2021-01-06 12:07, Willem de Bruijn wrote: >> >> On Tue, Jan 5, 2021 at 8:29 PM Dongseok Yi wrote: >>> >>> On 2021-01-05 06:03, Willem de Bruijn wrote: On Mon, Jan 4, 2021 at 4:00 AM Dongseok Yi wrote: > > skbs in frag_list could be shar

[PATCH net v4 1/2] net: sched: fix packet stuck problem for lockless qdisc

2021-04-15 Thread Yunsheng Lin
net: sched: allow qdiscs to handle locking") Signed-off-by: Yunsheng Lin Tested-by: Juergen Gross --- V4: Change STATE_NEED_RESCHEDULE to STATE_MISSED mirroring NAPI's NAPIF_STATE_MISSED, and add Juergen's "Tested-by" tag for there is only renaming and typo fixing betw

[PATCH net v4 2/2] net: sched: fix endless tx action reschedule during deactivation

2021-04-15 Thread Yunsheng Lin
the race without calling qdisc_run() at all, so remove the STATE_DEACTIVATED checking in qdisc_run(). After qdisc_reset(), there is no skb in qdisc to be dequeued, so clear the STATE_MISSED in dev_reset_queue() too. Fixes: 6b3ba9146fe6 ("net: sched: allow qdiscs to handle locking") S

[PATCH net v4 0/2] fix packet stuck problem for lockless qdisc

2021-04-15 Thread Yunsheng Lin
]. https://lkml.org/lkml/2019/10/9/42 Yunsheng Lin (2): net: sched: fix packet stuck problem for lockless qdisc net: sched: fix endless tx action reschedule during deactivation include/net/pkt_sched.h | 7 +-- include/net/sch_generic.h | 37 - net/core

[PATCH net v4 0/2] fix packet stuck problem for lockless qdisc

2021-04-15 Thread Yunsheng Lin
]. https://lkml.org/lkml/2019/10/9/42 Yunsheng Lin (2): net: sched: fix packet stuck problem for lockless qdisc net: sched: fix endless tx action reschedule during deactivation include/net/pkt_sched.h | 7 +-- include/net/sch_generic.h | 37 - net/core

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-13 Thread Yunsheng Lin
On 2021/4/13 16:33, Hillf Danton wrote: > On Tue, 13 Apr 2021 15:57:29 Yunsheng Lin wrote: >> On 2021/4/13 15:12, Hillf Danton wrote: >>> On Tue, 13 Apr 2021 11:34:27 Yunsheng Lin wrote: >>>> On 2021/4/13 11:26, Hillf Danton wrote: >>>>> On Tue, 13 Ap

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-13 Thread Yunsheng Lin
On 2021/4/13 15:12, Hillf Danton wrote: > On Tue, 13 Apr 2021 11:34:27 Yunsheng Lin wrote: >> On 2021/4/13 11:26, Hillf Danton wrote: >>> On Tue, 13 Apr 2021 10:56:42 Yunsheng Lin wrote: >>>> On 2021/4/13 10:21, Hillf Danton wrote: >>>>> On

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-12 Thread Yunsheng Lin
On 2021/4/13 11:26, Hillf Danton wrote: > On Tue, 13 Apr 2021 10:56:42 Yunsheng Lin wrote: >> On 2021/4/13 10:21, Hillf Danton wrote: >>> On Mon, 12 Apr 2021 20:00:43 Yunsheng Lin wrote: >>>> >>>> Yes, the below patch seems to fix the data race described

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-12 Thread Yunsheng Lin
On 2021/4/13 10:21, Hillf Danton wrote: > On Mon, 12 Apr 2021 20:00:43 Yunsheng Lin wrote: >> >> Yes, the below patch seems to fix the data race described in >> the commit log. >> Then what is the difference between my patch and your patch below:) > > Hehe, t

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-12 Thread Yunsheng Lin
On 2021/4/12 15:28, Hillf Danton wrote: > On Mon, 12 Apr 2021 11:37:24 Yunsheng Lin wrote: >> On 2021/4/12 11:21, Hillf Danton wrote: >>> On Mon, 12 Apr 2021 09:24:30 Yunsheng Lin wrote: >>>> On 2021/4/9 17:09, Hillf Danton wrote: >>>>> On Fri, 9 Apr

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-11 Thread Yunsheng Lin
On 2021/4/12 11:21, Hillf Danton wrote: > On Mon, 12 Apr 2021 09:24:30 Yunsheng Lin wrote: >> On 2021/4/9 17:09, Hillf Danton wrote: >>> On Fri, 9 Apr 2021 07:31:03 Juergen Gross wrote: >>>> On 25.03.21 04:13, Yunsheng Lin wrote: >>>> I have a setup

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-11 Thread Yunsheng Lin
On 2021/4/9 17:09, Hillf Danton wrote: > On Fri, 9 Apr 2021 07:31:03 Juergen Gross wrote: >> On 25.03.21 04:13, Yunsheng Lin wrote: >> I have a setup which is able to reproduce the issue quite reliably: >> >> In a Xen guest I'm mounting 8 NFS shares and run sysbenc

Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-04-11 Thread Yunsheng Lin
On 2021/4/9 13:31, Juergen Gross wrote: > On 25.03.21 04:13, Yunsheng Lin wrote: >> Lockless qdisc has below concurrent problem: >> cpu0 cpu1 >> . . >> q->enqueue . >> .

Re: Packet gets stuck in NOLOCK pfifo_fast qdisc

2021-04-06 Thread Yunsheng Lin
On 2021/4/6 15:31, Michal Kubecek wrote: > On Tue, Apr 06, 2021 at 10:46:29AM +0800, Yunsheng Lin wrote: >> On 2021/4/6 9:49, Cong Wang wrote: >>> On Sat, Apr 3, 2021 at 5:23 AM Jiri Kosina wrote: >>>> >>>> I am still planning to have Yunsheng Lin's

Re: Packet gets stuck in NOLOCK pfifo_fast qdisc

2021-04-06 Thread Yunsheng Lin
On 2021/4/6 18:13, Juergen Gross wrote: > On 06.04.21 09:06, Michal Kubecek wrote: >> On Tue, Apr 06, 2021 at 08:55:41AM +0800, Yunsheng Lin wrote: >>> >>> Hi, Jiri >>> Do you have a reproducer that can be shared here? >>> With reproducer, I can debu

Re: Packet gets stuck in NOLOCK pfifo_fast qdisc

2021-04-05 Thread Yunsheng Lin
On 2021/4/6 9:49, Cong Wang wrote: > On Sat, Apr 3, 2021 at 5:23 AM Jiri Kosina wrote: >> >> I am still planning to have Yunsheng Lin's (CCing) fix [1] tested in the >> coming days. If it works, then we can consider proceeding with it, >> otherwise I am all for reverting the whole NOLOCK stuff. >>

Re: Packet gets stuck in NOLOCK pfifo_fast qdisc

2021-04-05 Thread Yunsheng Lin
On 2021/4/3 20:23, Jiri Kosina wrote: > On Sat, 3 Apr 2021, Hillf Danton wrote: > > Sure. Seems they crept in over time. I had some plans to write a > lockless HTB implementation. But with fq+EDT with BPF it seems that > it is no longer needed, we have a more generic/better solution.

[PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc

2021-03-24 Thread Yunsheng Lin
qdiscs to handle locking") Signed-off-by: Yunsheng Lin --- V3: fix a compile error and a few comment typo, remove the __QDISC_STATE_DEACTIVATED checking, and update the performance data. V2: Avoid the overhead of fixing the data race as much as possible. --- include/

Re: [PATCH net v2] net: sched: fix packet stuck problem for lockless qdisc

2021-03-24 Thread Yunsheng Lin
On 2021/3/25 3:20, Cong Wang wrote: > On Tue, Mar 23, 2021 at 7:24 PM Yunsheng Lin wrote: >> @@ -176,8 +207,23 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) >> static inline void qdisc_run_end(struct Qdisc *qdisc) >> { >> write_seqcount_end(&

Re: [Linuxarm] Re: [RFC v2] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-23 Thread Yunsheng Lin
On 2021/3/24 9:49, Cong Wang wrote: > On Sun, Mar 21, 2021 at 5:55 PM Yunsheng Lin wrote: >> >> On 2021/3/20 2:15, Cong Wang wrote: >>> On Thu, Mar 18, 2021 at 12:33 AM Yunsheng Lin >>> wrote: >>>> >>>> On 2021/3/17 21:45, Jason A.

[PATCH net v2] net: sched: fix packet stuck problem for lockless qdisc

2021-03-23 Thread Yunsheng Lin
qdiscs to handle locking") Signed-off-by: Yunsheng Lin --- V2: Avoid the overhead of fixing the data race as much as possible. --- include/net/sch_generic.h | 48 ++- net/sched/sch_generic.c | 12 2 files changed, 59 insertions(+

Re: [RFC v3] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-23 Thread Yunsheng Lin
On 2021/3/23 14:37, Ahmad Fatoum wrote: > Hi, > > On 22.03.21 10:09, Yunsheng Lin wrote: >> Currently pfifo_fast has both TCQ_F_CAN_BYPASS and TCQ_F_NOLOCK >> flag set, but queue discipline by-pass does not work for lockless >> qdisc because skb is always enqueued t

[RFC v3] net: sched: implement TCQ_F_CAN_BYPASS for lockless qdisc

2021-03-22 Thread Yunsheng Lin
igned-off-by: Yunsheng Lin --- Hi, Vladimir and Ahmad Please give it a test to see if there is any out of order packet for this patch, which has removed the priv->lock added in RFC v2. There is a data race as below: CPU1 CPU2 qdisc

  1   2   3   4   >