Skip to content

Conversation

@vinser52
Copy link

@vinser52 vinser52 commented Sep 15, 2022

This change is Reviewable

@vinser52 vinser52 requested a review from byrnedj September 15, 2022 16:08
Copy link

@igchor igchor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some description to the commit. What was the problem and how does this fix it?

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @byrnedj and @vinser52)


cachelib/allocator/CacheAllocator-inl.h line 1644 at r1 (raw file):

    TierId tid, PoolId pid, Item& item) {
  if(item.isChainedItem()) return {}; // TODO: We do not support ChainedItem yet
  if(item.isExpired()) {

nit: you could use removeIfExpired (if you can get a handle first or change the predicate).

Copy link

@igchor igchor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @byrnedj and @vinser52)

The issue was caused by incorrect behaviour of the
CacheAllocator<CacheTrait>::tryEvictToNextMemoryTier method in case the
evicted item is expired. We cannot simply return a handle to it, but we need
to remove it from the access container and MM container.
Copy link
Author

@vinser52 vinser52 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @byrnedj and @igchor)


cachelib/allocator/CacheAllocator-inl.h line 1644 at r1 (raw file):

Previously, igchor (Igor Chorążewicz) wrote…

nit: you could use removeIfExpired (if you can get a handle first or change the predicate).

I saw removeIfExpired() function. But I do not want to use it because tryEvictToNextMemoryTier() function can be called on the hot path. And removeIfExpired() function calls accessContainer_->removeIf() with predicate to check if item is expired. Internally it grabs the bucket lock. I think it is too expensive on the hot path.
Furthermore, to call removeIfExpired() function we need to acquire a handle in that particular case. And think it is also might have some overhead because of atomic operation internally. All this action only need if the item is really expired - I believe, more frequently, item.isExpired() is false on this path.

But I have implemented another refactoring. When I did rebase of develop branch I blamed such refactoring... But now doing it by myself.
Less code we touch - less merge conflicts we have during rebase

Copy link

@igchor igchor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed all commit messages.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @byrnedj, @igchor, and @vinser52)


run_tests.sh line 4 at r3 (raw file):

# Newline separated list of tests to ignore
BLACKLIST="allocator-test-AllocatorTypeTest

why did you remove that?

Copy link
Author

@vinser52 vinser52 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @byrnedj and @igchor)


run_tests.sh line 4 at r3 (raw file):

Previously, igchor (Igor Chorążewicz) wrote…

why did you remove that?

I would ask why we have it in the black list. As I remember we created this blacklist to disable tests that are failed even on mainline. But bow this test are passed on mainline.
The issue fixed by this PR was introduced by me when I implemented transparent async Item movement. And if that test was enabled we would catch the issue during initial PR review.

@byrnedj
Copy link

byrnedj commented Sep 18, 2022

:lgtm:

Reviewed all commit messages.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @byrnedj, @igchor, and @vinser52)

run_tests.sh line 4 at r3 (raw file):

# Newline separated list of tests to ignore
BLACKLIST="allocator-test-AllocatorTypeTest

why did you remove that?

Because this is the test suite that was failing.

I agree with the logic behind refactoring removeIf - and it does effect item reaper code path so we may have merge conflicts later with upstream.

I can compile and pass all tests.

Copy link
Author

@vinser52 vinser52 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @byrnedj and @igchor)


run_tests.sh line 4 at r3 (raw file):

Because this is the test suite that was failing.

Yeah, I remember it. My point was that we should remove this from blacklist earlier (when test suite was fixed by Meta)

Copy link
Author

@vinser52 vinser52 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @byrnedj and @igchor)


run_tests.sh line 4 at r3 (raw file):

Previously, vinser52 (Sergei Vinogradov) wrote…

Because this is the test suite that was failing.

Yeah, I remember it. My point was that we should remove this from blacklist earlier (when test suite was fixed by Meta)

Which merge conflicts did you mean?

@vinser52 vinser52 merged commit 829a434 into intel:develop Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants