Skip to contentSkip to conversation

maple_tree: fix the comment on maple_arange_64 size

PATCH In review Wei Yang 2 participants 7 messages Jul 17, 2024

Subsystems (3)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 maple_tree: fix the comment on maple_arange_64 size

The comment here describe the size of struct maple_arange_64.

The value here is not correct. Fix it with the correct value.

CC "Liam R. Howlett" <[email protected]>

---
For 64BIT, value is get from kernel module. For 32BIT, value is get from user space pseudo code.

---
 include/linux/maple_tree.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/maple_tree.h +2 -2
index a53ad4dabd7e..8c87f8d0497d 100644
@@ -28,13 +28,13 @@
 /* 64bit sizes */
 #define MAPLE_NODE_SLOTS	31	/* 256 bytes including ->parent */
 #define MAPLE_RANGE64_SLOTS	16	/* 256 bytes */
-#define MAPLE_ARANGE64_SLOTS	10	/* 240 bytes */
+#define MAPLE_ARANGE64_SLOTS	10	/* 248 bytes */
 #define MAPLE_ALLOC_SLOTS	(MAPLE_NODE_SLOTS - 1)
 #else
 /* 32bit sizes */
 #define MAPLE_NODE_SLOTS	63	/* 256 bytes including ->parent */
 #define MAPLE_RANGE64_SLOTS	32	/* 256 bytes */
-#define MAPLE_ARANGE64_SLOTS	21	/* 240 bytes */
+#define MAPLE_ARANGE64_SLOTS	21	/* 256 bytes */
 #define MAPLE_ALLOC_SLOTS	(MAPLE_NODE_SLOTS - 2)
 #endif /* defined(CONFIG_64BIT) || defined(BUILD_VDSO32_64) */
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Wei Yang

The comment here describe the size of struct maple_arange_64.

The value here is not correct. Fix it with the correct value.

You are wrong.

author
#2 lore raw
Quoted 6 lines · Matthew Wilcox
Quoted 3 lines · Wei Yang

The comment here describe the size of struct maple_arange_64.

The value here is not correct. Fix it with the correct value.

You are wrong.

You mean the my value is wrong or my understanding is wrong?

Signature · 2 lines
Wei Yang
Help you, Help me
#3 lore raw
Quoted 9 lines · Wei Yang
Quoted 6 lines · Matthew Wilcox
Quoted 3 lines · Wei Yang

The comment here describe the size of struct maple_arange_64.

The value here is not correct. Fix it with the correct value.

You are wrong.

You mean the my value is wrong or my understanding is wrong?

Yes.

author
#4 lore raw
Quoted 5 lines · Matthew Wilcox
Quoted 4 lines · Wei Yang
Quoted 3 lines · Matthew Wilcox
Quoted 2 lines · Wei Yang

The comment here describe the size of struct maple_arange_64.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

The value here is not correct. Fix it with the correct value.

You are wrong.

You mean the my value is wrong or my understanding is wrong?

Yes.

I don't get it.

Would you mind sharing some light on what 240 bytes stands for? I don't figure out what size it represents.

Signature · 2 lines
Wei Yang
Help you, Help me
#5 lore raw
Quoted 10 lines · Wei Yang
Quoted 9 lines · Matthew Wilcox
Quoted 8 lines · Wei Yang
Quoted 6 lines · Matthew Wilcox
Quoted 3 lines · Wei Yang

The comment here describe the size of struct maple_arange_64.

The value here is not correct. Fix it with the correct value.

You are wrong.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

You mean the my value is wrong or my understanding is wrong?

Yes.

I don't get it.

Would you mind sharing some light on what 240 bytes stands for? I don't figure out what size it represents.

You first. How did you determine the new value you used?

author
#6 lore raw
Quoted 13 lines · Matthew Wilcox
Quoted 12 lines · Wei Yang
Quoted 11 lines · Matthew Wilcox
Quoted 9 lines · Wei Yang
Quoted 6 lines · Matthew Wilcox
Quoted 3 lines · Wei Yang

The comment here describe the size of struct maple_arange_64.

The value here is not correct. Fix it with the correct value.

You are wrong.

You mean the my value is wrong or my understanding is wrong?

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Yes.

I don't get it.

Would you mind sharing some light on what 240 bytes stands for? I don't figure out what size it represents.

You first. How did you determine the new value you used?

Sure.

My understanding of the comment is to represent the size of related data structures, eg. maple_node, maple_range_64 and maple_arange_64.

I add following code in test to the size of those structures.

lib/test_maple_tree.c +3 -0
index cea050675da2..93e77dea7f0b 100644
@@ -3645,6 +3645,10 @@ static int __init maple_tree_seed(void)
                                5003, 5002};
        void *ptr = &set;
 
+       pr_info("\nsizeof struct maple_node %ld\n", sizeof(struct maple_node));
+       pr_info("\nsizeof struct maple_range_64 %ld\n", sizeof(struct maple_range_64));
+       pr_info("\nsizeof struct maple_arange_64 %ld\n", sizeof(struct maple_arange_64));
 

Then insert the test module.

$ sudo insmod lib/test_maple_tree.ko
[  152.152382]
[  152.152382] sizeof struct maple_node 256
[  152.153043]
[  152.153043] sizeof struct maple_range_64 256
[  152.153561]
[  152.153561] sizeof struct maple_arange_64 248

The first two is the same as in comment, while the third one is not the same.

The 248 for 64BIT comes from here.

For 32BIT, I copied structure definition to a user space source and compile with -m32. The size of structure maple_arange_64 is 256. This is where 256 comes from.

Signature · 2 lines
Wei Yang
Help you, Help me