From: Michel Lespinasse <walken@google.com>
To: riel@redhat.com, peterz@infradead.org, vrajesh@umich.edu,
daniel.santos@pobox.com, aarcange@redhat.com,
dwmw2@infradead.org, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
torvalds@linux-foundation.org
Subject: Re: [PATCH 5/5] rbtree: move augmented rbtree functionality to rbtree_augmented.h
Date: Tue, 7 Aug 2012 18:19:12 -0700 [thread overview]
Message-ID: <CANN689EcSPkawZMQC-L-odANez+T0mVg_w4v6iOLL5WHcKACfw@mail.gmail.com> (raw)
In-Reply-To: <1344324343-3817-6-git-send-email-walken@google.com>
On Tue, Aug 7, 2012 at 12:25 AM, Michel Lespinasse <walken@google.com> wrote:
> Provide rb_insert_augmented() and rb_erase_augmented through
> a new rbtree_augmented.h include file. rb_erase_augmented() is defined
> there as an __always_inline function, in order to allow inlining of
> augmented rbtree callbacks into it. Since this generates a relatively
> large function, each augmented rbtree users should make sure to
> have a single call site.
I should probably add this to show how the code generation works out
in practice (with a gcc 4.6 based compiler)
Before this change:
text data bss dec hex filename
3426 0 0 3426 d62 lib/rbtree.o
0000000000000af0 g F .text 000000000000001e rb_last
0000000000000b80 g F .text 0000000000000047 rb_next
0000000000000000 g F .text 0000000000000165 rb_insert_color
0000000000000bd0 g F .text 0000000000000047 rb_prev
00000000000004e0 g F .text 00000000000001cd __rb_insert_augmented
0000000000000170 g F .text 000000000000036f rb_erase
00000000000006b0 g F .text 0000000000000416 rb_erase_augmented
0000000000000ad0 g F .text 000000000000001e rb_first
0000000000000b10 g F .text 000000000000006e rb_replace_node
text data bss dec hex filename
540 0 0 540 21c lib/interval_tree.o
0000000000000000 l F .text 0000000000000054
interval_tree_augment_propagate
0000000000000060 l F .text 000000000000000e interval_tree_augment_copy
0000000000000070 l F .text 000000000000003e
interval_tree_augment_rotate
00000000000000b0 g F .text 0000000000000065 interval_tree_insert
0000000000000120 g F .text 0000000000000012 interval_tree_remove
0000000000000140 g F .text 000000000000004c interval_tree_iter_first
0000000000000190 g F .text 0000000000000074 interval_tree_iter_next
After this change:
text data bss dec hex filename
2976 0 0 2976 ba0 lib/rbtree.o
0000000000000000 g F .text 000000000000025c __rb_erase_color
0000000000000930 g F .text 000000000000001e rb_last
00000000000009c0 g F .text 0000000000000047 rb_next
0000000000000260 g F .text 0000000000000165 rb_insert_color
0000000000000a10 g F .text 0000000000000047 rb_prev
0000000000000740 g F .text 00000000000001cd __rb_insert_augmented
00000000000003d0 g F .text 000000000000036f rb_erase
0000000000000910 g F .text 000000000000001e rb_first
0000000000000950 g F .text 000000000000006e rb_replace_node
text data bss dec hex filename
900 0 0 900 384 lib/interval_tree.o
0000000000000000 l F .text 000000000000003e
interval_tree_augment_rotate
0000000000000040 g F .text 0000000000000065 interval_tree_insert
00000000000000b0 g F .text 000000000000020b interval_tree_remove
00000000000002c0 g F .text 000000000000004c interval_tree_iter_first
0000000000000310 g F .text 0000000000000074 interval_tree_iter_next
So the code size effect is that the library code for augmented erase
shrinks by 450 bytes, and each augmented rb_erase user grows by (well,
this will very between users, but I think interval tree is
representative of a typical user) ~360 bytes. The rotate callback is
generated as a static function so it can be passed by pointer to the
library rebalancing routines; the copy and propagate functions are
inlined into interval_tree_remove (and the compiler is able to
determine that there are no remaining non-inlined calls, so it doesn't
generate an additional static definition).
--
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-08-08 1:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-07 7:25 [PATCH 0/5] rbtree based interval tree as a prio_tree replacement Michel Lespinasse
2012-08-07 7:25 ` [PATCH 1/5] rbtree: add prio tree and interval tree tests Michel Lespinasse
2012-08-07 7:25 ` [PATCH 2/5] mm: replace vma prio_tree with an interval tree Michel Lespinasse
2012-08-14 12:11 ` Hillf Danton
2012-08-07 7:25 ` [PATCH 3/5] kmemleak: use rbtree instead of prio tree Michel Lespinasse
2012-08-08 17:07 ` Michel Lespinasse
2012-08-09 8:31 ` Catalin Marinas
2012-08-15 16:36 ` Catalin Marinas
2012-08-15 20:53 ` Michel Lespinasse
2012-08-16 15:06 ` Catalin Marinas
2012-08-07 7:25 ` [PATCH 4/5] prio_tree: remove Michel Lespinasse
2012-08-07 7:25 ` [PATCH 5/5] rbtree: move augmented rbtree functionality to rbtree_augmented.h Michel Lespinasse
2012-08-08 1:19 ` Michel Lespinasse [this message]
2012-08-13 8:20 ` [PATCH 0/5] rbtree based interval tree as a prio_tree replacement Peter Zijlstra
2012-08-13 10:37 ` Michel Lespinasse
2012-08-30 21:34 ` Andrew Morton
2012-08-30 21:43 ` Rik van Riel
2012-08-30 22:33 ` Michel Lespinasse
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=CANN689EcSPkawZMQC-L-odANez+T0mVg_w4v6iOLL5WHcKACfw@mail.gmail.com \
--to=walken@google.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=daniel.santos@pobox.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=vrajesh@umich.edu \
/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