public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment
@ 2025-04-19  9:57 Haiyue Wang
  2025-04-19  9:57 ` [PATCH liburing v1 2/2] .gitignore: Add `examples/zcrx` Haiyue Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Haiyue Wang @ 2025-04-19  9:57 UTC (permalink / raw)
  To: io-uring; +Cc: Haiyue Wang

According to the 'Create refill ring' section in [1], use the macro
PAGE_SIZE instead of 4096 hard code number.

[1]: https://www.kernel.org/doc/html/latest/networking/iou-zcrx.html

Signed-off-by: Haiyue Wang <haiyuewa@163.com>
---
 examples/zcrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/zcrx.c b/examples/zcrx.c
index 8393cfe..c96bbfe 100644
--- a/examples/zcrx.c
+++ b/examples/zcrx.c
@@ -66,7 +66,7 @@ static inline size_t get_refill_ring_size(unsigned int rq_entries)
 	ring_size = rq_entries * sizeof(struct io_uring_zcrx_rqe);
 	/* add space for the header (head/tail/etc.) */
 	ring_size += PAGE_SIZE;
-	return T_ALIGN_UP(ring_size, 4096);
+	return T_ALIGN_UP(ring_size, PAGE_SIZE);
 }
 
 static void setup_zcrx(struct io_uring *ring)
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH liburing v1 2/2] .gitignore: Add `examples/zcrx`
  2025-04-19  9:57 [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment Haiyue Wang
@ 2025-04-19  9:57 ` Haiyue Wang
  2025-04-19 12:51 ` [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment Jens Axboe
  2025-04-19 12:52 ` (subset) " Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Haiyue Wang @ 2025-04-19  9:57 UTC (permalink / raw)
  To: io-uring; +Cc: Haiyue Wang

Add the built binary 'zcrx' for clean git track.

Signed-off-by: Haiyue Wang <haiyuewa@163.com>
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 4148091..c693631 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,7 @@
 /examples/rsrc-update-bench
 /examples/kdigest
 /examples/reg-wait
+/examples/zcrx
 
 /test/*.t
 /test/*.dmesg
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment
  2025-04-19  9:57 [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment Haiyue Wang
  2025-04-19  9:57 ` [PATCH liburing v1 2/2] .gitignore: Add `examples/zcrx` Haiyue Wang
@ 2025-04-19 12:51 ` Jens Axboe
  2025-04-19 13:13   ` Haiyue Wang
  2025-04-19 12:52 ` (subset) " Jens Axboe
  2 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2025-04-19 12:51 UTC (permalink / raw)
  To: Haiyue Wang, io-uring

On 4/19/25 3:57 AM, Haiyue Wang wrote:
> According to the 'Create refill ring' section in [1], use the macro
> PAGE_SIZE instead of 4096 hard code number.
> 
> [1]: https://www.kernel.org/doc/html/latest/networking/iou-zcrx.html
> 
> Signed-off-by: Haiyue Wang <haiyuewa@163.com>
> ---
>  examples/zcrx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/zcrx.c b/examples/zcrx.c
> index 8393cfe..c96bbfe 100644
> --- a/examples/zcrx.c
> +++ b/examples/zcrx.c
> @@ -66,7 +66,7 @@ static inline size_t get_refill_ring_size(unsigned int rq_entries)
>  	ring_size = rq_entries * sizeof(struct io_uring_zcrx_rqe);
>  	/* add space for the header (head/tail/etc.) */
>  	ring_size += PAGE_SIZE;
> -	return T_ALIGN_UP(ring_size, 4096);
> +	return T_ALIGN_UP(ring_size, PAGE_SIZE);
>  }
>  
>  static void setup_zcrx(struct io_uring *ring)

Well, in that same file:

#define PAGE_SIZE (4096)         

so this won't really fix anything. Examples or test code
should use:

sysconf(_SC_PAGESIZE)

to get the page size at runtime.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: (subset) [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment
  2025-04-19  9:57 [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment Haiyue Wang
  2025-04-19  9:57 ` [PATCH liburing v1 2/2] .gitignore: Add `examples/zcrx` Haiyue Wang
  2025-04-19 12:51 ` [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment Jens Axboe
@ 2025-04-19 12:52 ` Jens Axboe
  2 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2025-04-19 12:52 UTC (permalink / raw)
  To: io-uring, Haiyue Wang


On Sat, 19 Apr 2025 17:57:20 +0800, Haiyue Wang wrote:
> According to the 'Create refill ring' section in [1], use the macro
> PAGE_SIZE instead of 4096 hard code number.
> 
> [1]: https://www.kernel.org/doc/html/latest/networking/iou-zcrx.html
> 
> 

Applied, thanks!

[2/2] .gitignore: Add `examples/zcrx`
      commit: 7245359287ef984056d2ed1a62b110196492b93e

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment
  2025-04-19 12:51 ` [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment Jens Axboe
@ 2025-04-19 13:13   ` Haiyue Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Haiyue Wang @ 2025-04-19 13:13 UTC (permalink / raw)
  To: Jens Axboe, io-uring



On 2025/4/19 20:51, Jens Axboe wrote:
> On 4/19/25 3:57 AM, Haiyue Wang wrote:
>> According to the 'Create refill ring' section in [1], use the macro
>> PAGE_SIZE instead of 4096 hard code number.
>>
>> [1]: https://www.kernel.org/doc/html/latest/networking/iou-zcrx.html
>>
>> Signed-off-by: Haiyue Wang <haiyuewa@163.com>
>> ---
>>   examples/zcrx.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/examples/zcrx.c b/examples/zcrx.c
>> index 8393cfe..c96bbfe 100644
>> --- a/examples/zcrx.c
>> +++ b/examples/zcrx.c
>> @@ -66,7 +66,7 @@ static inline size_t get_refill_ring_size(unsigned int rq_entries)
>>   	ring_size = rq_entries * sizeof(struct io_uring_zcrx_rqe);
>>   	/* add space for the header (head/tail/etc.) */
>>   	ring_size += PAGE_SIZE;
>> -	return T_ALIGN_UP(ring_size, 4096);
>> +	return T_ALIGN_UP(ring_size, PAGE_SIZE);
>>   }
>>   
>>   static void setup_zcrx(struct io_uring *ring)
> 
> Well, in that same file:
> 
> #define PAGE_SIZE (4096)
> 
> so this won't really fix anything. Examples or test code
> should use:

The original plan is to make the code consistent for page size as:
	ring_size += PAGE_SIZE

> 
> sysconf(_SC_PAGESIZE)
> 

So fix it as 'examples/proxy'?

	static long page_size;

	page_size = sysconf(_SC_PAGESIZE);
	if (page_size < 0) {
		perror("sysconf(_SC_PAGESIZE)");
		return 1;
	}

> to get the page size at runtime.
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-04-19 13:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-19  9:57 [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment Haiyue Wang
2025-04-19  9:57 ` [PATCH liburing v1 2/2] .gitignore: Add `examples/zcrx` Haiyue Wang
2025-04-19 12:51 ` [PATCH liburing v1 1/2] examples/zcrx: Use PAGE_SIZE for ring refill alignment Jens Axboe
2025-04-19 13:13   ` Haiyue Wang
2025-04-19 12:52 ` (subset) " Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox