Skip to contentSkip to conversation

io_uring: Add register support to other PAGE_SIZE

PATCH In review Jens Axboe 2 participants 3 messages Aug 18, 2021 – Aug 19, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jens Axboe

author maintainer
#1 lore raw
Quoted 1 line · wangyangbo

Define rsrc table shift from PAGE_SHIFT

This really needs a lot better explanation. A good commit message explains "why" a change is done, this one doesn't have anything really. It briefly tells you "what" is being done, but no reasoning for why.

Signature · 1 line
Jens Axboe
#2 lore raw

PATCH 1/1 io_uring: Add register support to other PAGE_SIZE

Now allocated rsrc table uses PAGE_SIZE as the size of 2nd-level, and accessing this table relies on each level index from fixed TABLE_SHIFT (12 - 3) in 4k page case. In order to correctly work in non-4k page, define TABLE_SHIFT as non-fixed (PAGE_SHIFT - shift of data) for 2nd-level table entry number.

---
pleasure to receive comments

 fs/io_uring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/io_uring.c +2 -2
index 4d5c970eacdb..605b008ba29b 100644
@@ -92,12 +92,12 @@
 #define IORING_MAX_CQ_ENTRIES	(2 * IORING_MAX_ENTRIES)
 #define IORING_SQPOLL_CAP_ENTRIES_VALUE 8
 
-/* 512 entries per page on 64-bit archs, 64 pages max */
+/* only define max */
 #define IORING_MAX_FIXED_FILES	(1U << 15)
 #define IORING_MAX_RESTRICTIONS	(IORING_RESTRICTION_LAST + \
 				 IORING_REGISTER_LAST + IORING_OP_LAST)
 
-#define IO_RSRC_TAG_TABLE_SHIFT	9
+#define IO_RSRC_TAG_TABLE_SHIFT	(PAGE_SHIFT - 3)
 #define IO_RSRC_TAG_TABLE_MAX	(1U << IO_RSRC_TAG_TABLE_SHIFT)
 #define IO_RSRC_TAG_TABLE_MASK	(IO_RSRC_TAG_TABLE_MAX - 1)
 
Signature · 1 line
2.20.1
author maintainer
#3 lore raw
Quoted 5 lines · wangyangbo

Now allocated rsrc table uses PAGE_SIZE as the size of 2nd-level, and accessing this table relies on each level index from fixed TABLE_SHIFT (12 - 3) in 4k page case. In order to correctly work in non-4k page, define TABLE_SHIFT as non-fixed (PAGE_SHIFT - shift of data) for 2nd-level table entry number.

That's a lot better! Thanks, applied for 5.15.

Signature · 1 line
Jens Axboe