RESOLVED FIXED224677
Before deleting a MarkedBlock we do not need to clear its m_directory pointer.
https://bugs.webkit.org/show_bug.cgi?id=224677
Summary Before deleting a MarkedBlock we do not need to clear its m_directory pointer.
Keith Miller
Reported 2021-04-16 10:06:20 PDT
Before deleting a MarkedBlock we do not need to clear its m_directory pointer.
Attachments
Patch (4.19 KB, patch)
2021-04-16 10:14 PDT, Keith Miller
no flags
Patch for landing (4.48 KB, patch)
2021-04-16 11:30 PDT, Keith Miller
no flags
Keith Miller
Comment 1 2021-04-16 10:14:20 PDT
Mark Lam
Comment 2 2021-04-16 10:31:04 PDT
Comment on attachment 426246 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=426246&action=review > Source/JavaScriptCore/ChangeLog:11 > + This patch adds prevents this uncessary store to hopefully reduce the number /adds prevents/prevents/ > Source/JavaScriptCore/heap/MarkedBlock.cpp:-79 > - removeFromDirectory(); Why is this ok? Wouldn't this leave the directory in a stale state?
Keith Miller
Comment 3 2021-04-16 10:34:23 PDT
Comment on attachment 426246 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=426246&action=review >> Source/JavaScriptCore/heap/MarkedBlock.cpp:-79 >> - removeFromDirectory(); > > Why is this ok? Wouldn't this leave the directory in a stale state? Well, it's unnecessary. The only place we destruct handles (MarkedSpace::freeBlock) already removes the MarkedBlock from the directory before calling delete.
Keith Miller
Comment 4 2021-04-16 10:34:38 PDT
Comment on attachment 426246 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=426246&action=review >> Source/JavaScriptCore/ChangeLog:11 >> + This patch adds prevents this uncessary store to hopefully reduce the number > > /adds prevents/prevents/ fixed. >>> Source/JavaScriptCore/heap/MarkedBlock.cpp:-79 >>> - removeFromDirectory(); >> >> Why is this ok? Wouldn't this leave the directory in a stale state? > > Well, it's unnecessary. The only place we destruct handles (MarkedSpace::freeBlock) already removes the MarkedBlock from the directory before calling delete. Well, it's unnecessary. The only place we destruct handles (MarkedSpace::freeBlock) already removes the MarkedBlock from the directory before calling delete.
Geoffrey Garen
Comment 5 2021-04-16 10:34:56 PDT
Comment on attachment 426246 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=426246&action=review > Source/JavaScriptCore/ChangeLog:10 > + paging in the footer from disk, which some data we have seen shows is happening. from disk or from the compressor > Source/JavaScriptCore/ChangeLog:11 > + This patch adds prevents this uncessary store to hopefully reduce the number adds prevents => prevents > Source/JavaScriptCore/ChangeLog:12 > + of pageins caused by Safari web content on Mac. compressor effect pertains to iOS too > Source/JavaScriptCore/heap/BlockDirectory.cpp:145 > + removeBlockForDeletion(block); Surprising to say "for deletion" when we are not deleting. How about instead adding an enum class WillDeleteBlock { Yes, No } parameter to removeBlock() that defaults to WillDeleteBlock::No? Then removeBlock() can call didRemoveFromDirectory if willDeleteBlock == WillDeleteBlock::YES. > Source/JavaScriptCore/heap/MarkedBlock.cpp:-79 > - removeFromDirectory(); Is this OK? Why?
Yusuke Suzuki
Comment 6 2021-04-16 10:36:09 PDT
Comment on attachment 426246 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=426246&action=review >>>>> Source/JavaScriptCore/heap/MarkedBlock.cpp:-79 >>>>> - removeFromDirectory(); >>>> >>>> Why is this ok? Wouldn't this leave the directory in a stale state? >>> >>> Well, it's unnecessary. The only place we destruct handles (MarkedSpace::freeBlock) already removes the MarkedBlock from the directory before calling delete. >> >> Well, it's unnecessary. The only place we destruct handles (MarkedSpace::freeBlock) already removes the MarkedBlock from the directory before calling delete. > > Is this OK? Why? Only MarkedSpace::freeBlock calls this destructor, and it is calling removeBlockForDeletion. So, this does nothing in practice. When calling it, m_directory was always nullptr.
Keith Miller
Comment 7 2021-04-16 10:45:19 PDT
Comment on attachment 426246 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=426246&action=review >> Source/JavaScriptCore/heap/BlockDirectory.cpp:145 >> + removeBlockForDeletion(block); > > Surprising to say "for deletion" when we are not deleting. > > How about instead adding an enum class WillDeleteBlock { Yes, No } parameter to removeBlock() that defaults to WillDeleteBlock::No? Then removeBlock() can call didRemoveFromDirectory if willDeleteBlock == WillDeleteBlock::YES. Sure, that's fine. >>>>>> Source/JavaScriptCore/heap/MarkedBlock.cpp:-79 >>>>>> - removeFromDirectory(); >>>>> >>>>> Why is this ok? Wouldn't this leave the directory in a stale state? >>>> >>>> Well, it's unnecessary. The only place we destruct handles (MarkedSpace::freeBlock) already removes the MarkedBlock from the directory before calling delete. >>> >>> Well, it's unnecessary. The only place we destruct handles (MarkedSpace::freeBlock) already removes the MarkedBlock from the directory before calling delete. >> >> Is this OK? Why? > > Only MarkedSpace::freeBlock calls this destructor, and it is calling removeBlockForDeletion. > So, this does nothing in practice. When calling it, m_directory was always nullptr. I'll actually change this so we still call removeFromDirectory() here and remove the call from MarkedSpace::freeBlock. That way it's a bit more obvious what's going on.
Geoffrey Garen
Comment 8 2021-04-16 10:46:10 PDT
> How about instead adding an enum class WillDeleteBlock { Yes, No } parameter > to removeBlock() that defaults to WillDeleteBlock::No? Then removeBlock() > can call didRemoveFromDirectory if willDeleteBlock == WillDeleteBlock::YES. I mean NO! :P
Keith Miller
Comment 9 2021-04-16 11:30:58 PDT
Created attachment 426252 [details] Patch for landing
EWS
Comment 10 2021-04-16 12:24:30 PDT
Committed r276155 (236646@main): <https://commits.webkit.org/236646@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 426252 [details].
Geoffrey Garen
Comment 11 2021-04-16 14:48:45 PDT
Note You need to log in before you can comment on or make changes to this bug.