You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Todd Lipcon (Code Review)" <ge...@cloudera.org> on 2017/03/27 01:48:00 UTC
[kudu-CR] arena: fix alignment of NewObject<> results, use variadic template
Todd Lipcon has uploaded a new change for review.
http://gerrit.cloudera.org:8080/6492
Change subject: arena: fix alignment of NewObject<> results, use variadic template
......................................................................
arena: fix alignment of NewObject<> results, use variadic template
This makes two fixes to Arena<>::NewObject<>:
* Ensures that the returned object has the proper alignment required by
the type being allocated. This fixes spurious leak warnings if the
leak checker is run while there is a live object allocated from an
arena which has pointers pointing out it.
* Use C++11 variadic templates instead of multiple definitions for
different parameter list lengths.
Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
---
M src/kudu/util/memory/arena-test.cc
M src/kudu/util/memory/arena.h
2 files changed, 21 insertions(+), 44 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/92/6492/1
--
To view, visit http://gerrit.cloudera.org:8080/6492
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
[kudu-CR] arena: fix alignment of NewObject<> results, use variadic template
Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.
Change subject: arena: fix alignment of NewObject<> results, use variadic template
......................................................................
Patch Set 2: Verified+1
Jenkins issue seems unrelated (timing issue)
--
To view, visit http://gerrit.cloudera.org:8080/6492
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No
[kudu-CR] arena: fix alignment of NewObject<> results, use variadic template
Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/6492
to look at the new patch set (#2).
Change subject: arena: fix alignment of NewObject<> results, use variadic template
......................................................................
arena: fix alignment of NewObject<> results, use variadic template
This makes two fixes to Arena<>::NewObject<>:
* Ensures that the returned object has the proper alignment required by
the type being allocated. This fixes spurious leak warnings if the
leak checker is run while there is a live object allocated from an
arena which has pointers pointing out it. I hit this issue with a
later patch in this same patch series which changes RowOp to be
arena-allocated.
* Use C++11 variadic templates instead of multiple definitions for
different parameter list lengths.
Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
---
M src/kudu/util/memory/arena-test.cc
M src/kudu/util/memory/arena.h
2 files changed, 22 insertions(+), 44 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/92/6492/2
--
To view, visit http://gerrit.cloudera.org:8080/6492
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
[kudu-CR] arena: fix alignment of NewObject<> results, use variadic template
Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change.
Change subject: arena: fix alignment of NewObject<> results, use variadic template
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit http://gerrit.cloudera.org:8080/6492
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: No
[kudu-CR] arena: fix alignment of NewObject<> results, use variadic template
Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has submitted this change and it was merged.
Change subject: arena: fix alignment of NewObject<> results, use variadic template
......................................................................
arena: fix alignment of NewObject<> results, use variadic template
This makes two fixes to Arena<>::NewObject<>:
* Ensures that the returned object has the proper alignment required by
the type being allocated. This fixes spurious leak warnings if the
leak checker is run while there is a live object allocated from an
arena which has pointers pointing out it. I hit this issue with a
later patch in this same patch series which changes RowOp to be
arena-allocated.
* Use C++11 variadic templates instead of multiple definitions for
different parameter list lengths.
Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
Reviewed-on: http://gerrit.cloudera.org:8080/6492
Reviewed-by: Adar Dembo <ad...@cloudera.com>
Tested-by: Todd Lipcon <to...@apache.org>
---
M src/kudu/util/memory/arena-test.cc
M src/kudu/util/memory/arena.h
2 files changed, 22 insertions(+), 44 deletions(-)
Approvals:
Adar Dembo: Looks good to me, approved
Todd Lipcon: Verified
--
To view, visit http://gerrit.cloudera.org:8080/6492
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
Gerrit-PatchSet: 3
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
[kudu-CR] arena: fix alignment of NewObject<> results, use variadic template
Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change.
Change subject: arena: fix alignment of NewObject<> results, use variadic template
......................................................................
Patch Set 1:
(3 comments)
http://gerrit.cloudera.org:8080/#/c/6492/1//COMMIT_MSG
Commit Message:
PS1, Line 12: This fixes spurious leak warnings if the
: leak checker is run while there is a live object allocated from an
: arena which has pointers pointing out it.
I presume this is how you noticed this in the first place, but what was the larger context? From a flaky test, perhaps?
http://gerrit.cloudera.org:8080/#/c/6492/1/src/kudu/util/memory/arena-test.cc
File src/kudu/util/memory/arena-test.cc:
Line 109: a.AllocateBytes(1);
Why is it important to allocate one byte first? Is it because otherwise the first allocation out of the arena will naturally be aligned? Either way, could you explain in a comment?
http://gerrit.cloudera.org:8080/#/c/6492/1/src/kudu/util/memory/arena.h
File src/kudu/util/memory/arena.h:
Line 470: void *mem = AllocateBytesAligned(sizeof(T), alignof(T));
Any idea why this wasn't aligned in the first place? This is pretty old code, right?
--
To view, visit http://gerrit.cloudera.org:8080/6492
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-HasComments: Yes
[kudu-CR] arena: fix alignment of NewObject<> results, use variadic template
Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.
Change subject: arena: fix alignment of NewObject<> results, use variadic template
......................................................................
Patch Set 1:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/6492/1//COMMIT_MSG
Commit Message:
PS1, Line 12: This fixes spurious leak warnings if the
: leak checker is run while there is a live object allocated from an
: arena which has pointers pointing out it.
> I presume this is how you noticed this in the first place, but what was the
from the patch later in this series which changes RowOp to be arena-allocated
--
To view, visit http://gerrit.cloudera.org:8080/6492
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes
[kudu-CR] arena: fix alignment of NewObject<> results, use variadic template
Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change.
Change subject: arena: fix alignment of NewObject<> results, use variadic template
......................................................................
Patch Set 1:
(2 comments)
http://gerrit.cloudera.org:8080/#/c/6492/1/src/kudu/util/memory/arena-test.cc
File src/kudu/util/memory/arena-test.cc:
Line 109: a.AllocateBytes(1);
> Why is it important to allocate one byte first? Is it because otherwise the
Done
http://gerrit.cloudera.org:8080/#/c/6492/1/src/kudu/util/memory/arena.h
File src/kudu/util/memory/arena.h:
Line 470: void *mem = AllocateBytesAligned(sizeof(T), alignof(T));
> Any idea why this wasn't aligned in the first place? This is pretty old cod
yea, I wrote the NewObject function back in Feb '13, and I think at that time my logic was that unaligned access is reasonably fast on xeon, and therefore it wasn't a big deal to try to get stuff aligned. Didn't realize about the leak-checker implications at the time, nor the impact on AVX/SSE code that might get emitted.
--
To view, visit http://gerrit.cloudera.org:8080/6492
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Idad12bee02eebf58bf8d545812a7d161bb829b71
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-HasComments: Yes