swiftlang / swift-corelibs-libdispatch

The libdispatch Project, (a.k.a. Grand Central Dispatch), for concurrency on multicore hardware
swift.org
Apache License 2.0
2.47k stars 460 forks source link

[SR-13841] Perf Incorrectly Assigns Dispatch Calls #608

Open swift-ci opened 3 years ago

swift-ci commented 3 years ago
Previous ID SR-13841
Radar rdar://problem/71271956
Original Reporter xanderai (JIRA User)
Type Bug

Attachment: Download

Environment This was run on Ubuntu 18.04 with Swift for Tensorflow 0.10: \`\`\` $ swift --version Swift version 5.3-dev (LLVM 55d27a5828, Swift 6a5d84ec08) Target: x86_64-unknown-linux-gnu $ which swift /home/xander/swift-tensorflow-RELEASE-0.10-cuda10.2-cudnn7-ubuntu18.04/usr/bin/swift \`\`\` I don't believe it's specific to Swift for Tensorflow.
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | libdispatch | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 5c2364057133aadaf7ecfa69ab055195

Issue Description:

This is based on the Swift Forums discussion here.

Find attached a screenshot of a perf flamegraph that was captured on 8 hours of a Swift server that uses Swift NIO and serial async DispatchQueues. Notice that everything above the `_dispatch_call_block_and_release` is occurring on the serial DispatchQueues. We think those call stacks are not actually executing on NIO's threads, but have been incorrectly assigned to them by perf. It seems like dispatch is missing some debug symbols, which prevents perf getting an accurate handle on how we get into `_dispatch_call_block_and_release`.

This flame graph was collected using the instructions here.

![](Screen Shot 2020-11-08 at 22.30.34.png)

Lukasa commented 3 years ago

@swift-ci create