Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/bluestore: avoid unneeded BlobRefing in _do_read(). #19864

Merged
merged 1 commit into from Jan 10, 2018

Conversation

rzarzynski
Copy link
Contributor

The hottest place in the terms of CPU cycles according to perf annotate:

       |          intrusive_ptr(intrusive_ptr const & rhs): px( rhs.px )
  0,04 | 365:   mov    0x28(%rax),%r12
       |          {
       |              if( px != 0 ) intrusive_ptr_add_ref( px );
  0,41 |        test   %r12,%r12
       |      ↓ je     37c
       |      _ZNSt13__atomic_baseIiEppEv():
  0,04 |        lock   addl   $0x1,(%r12)
 19,75 |        mov    0xa8(%rsp),%rax
       |      _ZN9BlueStore8_do_readEPNS_10CollectionEN5boost13intrusive_ptrINS_5OnodeEEEmmRN4ceph6buffer4listEj():
       |          }
       |          BlobRef bptr = lp->blob;
       |          unsigned l_off = pos - lp->logical_offset
       | 37c:   mov    0xa0(%rsp),%rdx
       |        sub    0x18(%rax),%edx
       |          unsigned b_off = l_off + lp->blob_offset;
  0,08 |        mov    0x1c(%rax),%ecx

With the patch applied:

       |          T * operator->() const
       |          {
       |              BOOST_ASSERT( px != 0 );
       |              return px;
       |        mov    0x28(%rcx),%rax
       |        mov    0x8(%rax),%rax
       |      _ZN9BlueStore8_do_readEPNS_10CollectionEN5boost13intrusive_ptrINS
       |          unsigned b_len = std::min(left, lp->length - l_off);
       |
       |          ready_regions_t cache_res;
       |          interval_set<uint32_t> cache_interval;
       |          bptr->shared_blob->bc.read(
 17,78 |        lea    0x18(%rax),%rdi
       |      _ZNK5boost13intrusive_ptrIN9BlueStore10CollectionEEcvbEv():
       |      #if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !
       |          && !(defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <=
       |
       |          explicit operator bool () const BOOST_NOEXCEPT
       |          {
       |              return px != 0;
  0,07 |        mov    0x8(%rax),%rax

Signed-off-by: Radoslaw Zarzynski rzarzyns@redhat.com

The hottest place in the terms of CPU cycles according to `perf annotate`:
```
       |          intrusive_ptr(intrusive_ptr const & rhs): px( rhs.px )
  0,04 | 365:   mov    0x28(%rax),%r12
       |          {
       |              if( px != 0 ) intrusive_ptr_add_ref( px );
  0,41 |        test   %r12,%r12
       |      ↓ je     37c
       |      _ZNSt13__atomic_baseIiEppEv():
  0,04 |        lock   addl   $0x1,(%r12)
 19,75 |        mov    0xa8(%rsp),%rax
       |      _ZN9BlueStore8_do_readEPNS_10CollectionEN5boost13intrusive_ptrINS_5OnodeEEEmmRN4ceph6buffer4listEj():
       |          }
       |          BlobRef bptr = lp->blob;
       |          unsigned l_off = pos - lp->logical_offset
       | 37c:   mov    0xa0(%rsp),%rdx
       |        sub    0x18(%rax),%edx
       |          unsigned b_off = l_off + lp->blob_offset;
  0,08 |        mov    0x1c(%rax),%ecx
```

With the patch applied:

```
       |          T * operator->() const
       |          {
       |              BOOST_ASSERT( px != 0 );
       |              return px;
       |        mov    0x28(%rcx),%rax
       |        mov    0x8(%rax),%rax
       |      _ZN9BlueStore8_do_readEPNS_10CollectionEN5boost13intrusive_ptrINS
       |          unsigned b_len = std::min(left, lp->length - l_off);
       |
       |          ready_regions_t cache_res;
       |          interval_set<uint32_t> cache_interval;
       |          bptr->shared_blob->bc.read(
 17,78 |        lea    0x18(%rax),%rdi
       |      _ZNK5boost13intrusive_ptrIN9BlueStore10CollectionEEcvbEv():
       |      #if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !
       |          && !(defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <=
       |
       |          explicit operator bool () const BOOST_NOEXCEPT
       |          {
       |              return px != 0;
  0,07 |        mov    0x8(%rax),%rax
```

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants