]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
common/buffer_seastar: fix alien threads memory
authorMatan Breizman <mbreizma@redhat.com>
Mon, 19 Feb 2024 12:24:52 +0000 (12:24 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Mon, 6 May 2024 12:10:49 +0000 (15:10 +0300)
commit401270145116388caf32c6937eb9b8d1b7a57413
tree2c5039ec6e83b242635794f2387ba8e5ea11d133
parent777ed20e97e73aa9311c30a9e659c93a89176496
common/buffer_seastar: fix alien threads memory

The underlying raw_seastar_foreign_ptr::ptr is allocated from seastar.
This ptr is wrapped with seastar::foreign_ptr:
```
/// \c foreign_ptr<> wraps smart pointers -- \ref seastar::shared_ptr<>,
/// or similar, and remembers on what core this happened.
/// When the \c foreign_ptr<> object is destroyed, it sends a message to
/// the original core so that the wrapped object can be safely destroyed.
```

The issue is that once the pointer is de-allocated from an alien thread
it is unable to send a message to the original core.
Fix this issue by making use of seastar::alien integration with non-seastar applications.
In case ~raw_seastar_foreign_ptr() will be called from an alien thread, we will submit *and wait*
for the memory to be released from the origin core.

Fixes: https://tracker.ceph.com/issues/64086
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
(cherry picked from commit c714c3c4f92994413e34a5900492c8987c85669e)
src/common/buffer_seastar.cc