linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Wei Yang <richard.weiyang@gmail.com>,
	Liam.Howlett@oracle.com, maple-tree@lists.infradead.org,
	linux-mm@kvack.org
Subject: Re: [PATCH] maple_tree: fix the comment on maple_arange_64 size
Date: Wed, 17 Jul 2024 07:05:12 +0000	[thread overview]
Message-ID: <20240717070512.giyxesbkbxdseb5f@master> (raw)
In-Reply-To: <Zpc0_5KxbEh4ACKV@casper.infradead.org>

On Wed, Jul 17, 2024 at 04:05:35AM +0100, Matthew Wilcox wrote:
>On Wed, Jul 17, 2024 at 03:03:13AM +0000, Wei Yang wrote:
>> On Wed, Jul 17, 2024 at 03:45:40AM +0100, Matthew Wilcox wrote:
>> >On Wed, Jul 17, 2024 at 02:41:26AM +0000, Wei Yang wrote:
>> >> On Wed, Jul 17, 2024 at 03:06:01AM +0100, Matthew Wilcox wrote:
>> >> >On Wed, Jul 17, 2024 at 01:41:42AM +0000, Wei Yang wrote:
>> >> >> 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.
>> 
>> 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.

diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c
index cea050675da2..93e77dea7f0b 100644
--- a/lib/test_maple_tree.c
+++ b/lib/test_maple_tree.c
@@ -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.


-- 
Wei Yang
Help you, Help me


      reply	other threads:[~2024-07-17  7:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17  1:41 [PATCH] maple_tree: fix the comment on maple_arange_64 size Wei Yang
2024-07-17  2:06 ` Matthew Wilcox
2024-07-17  2:41   ` Wei Yang
2024-07-17  2:45     ` Matthew Wilcox
2024-07-17  3:03       ` Wei Yang
2024-07-17  3:05         ` Matthew Wilcox
2024-07-17  7:05           ` Wei Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240717070512.giyxesbkbxdseb5f@master \
    --to=richard.weiyang@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).