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

Require three epoch advancements for deallocation #416

Merged
2 commits merged into from
May 20, 2020

Conversation

tomtomjhj
Copy link
Contributor

This patch implements the fix discussed in #238 (comment).

  • tag the Bag with the local epoch E
  • free at E+3

Copy link
Contributor

@jeehoonkang jeehoonkang left a comment

Choose a reason for hiding this comment

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

LGTM. Would you please have a look? @stjepang @blitzerr @Pslydhh

@blitzerr
Copy link

@jeehoonkang I will take a look.

@jeehoonkang
Copy link
Contributor

@tomtomjhj would you please rebase it on the current master? We recently fixed CI failures.

atomic::fence(Ordering::SeqCst);
}

// Now we validate that the value we read from the global epoch is not stale.
Copy link

Choose a reason for hiding this comment

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

What is the motivation for validation phase? I'm afraid that this loop might slow things down a bit.

Could you run cargo bench and see if this affects performance?

Copy link
Contributor Author

@tomtomjhj tomtomjhj Oct 28, 2019

Choose a reason for hiding this comment

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

It's for helping the global epoch advancement in general. It doesn't seem to have a meaningful effect on the performance.

  • master:
test multi_alloc_defer_free  ... bench:   4,135,110 ns/iter (+/- 566,246)
test multi_defer             ... bench:   2,154,671 ns/iter (+/- 212,984)
test single_alloc_defer_free ... bench:          43 ns/iter (+/- 0)
test single_defer            ... bench:          16 ns/iter (+/- 0)

test multi_flush  ... bench:  22,928,416 ns/iter (+/- 1,546,218)
test single_flush ... bench:         136 ns/iter (+/- 1)

test multi_pin  ... bench:   4,179,789 ns/iter (+/- 167,156)
test single_pin ... bench:           5 ns/iter (+/- 0)
  • free-after-3
test multi_alloc_defer_free  ... bench:   4,176,331 ns/iter (+/- 513,890)
test multi_defer             ... bench:   2,179,475 ns/iter (+/- 197,665)
test single_alloc_defer_free ... bench:          43 ns/iter (+/- 1)
test single_defer            ... bench:          16 ns/iter (+/- 0)

test multi_flush  ... bench:  21,997,370 ns/iter (+/- 3,973,497)
test single_flush ... bench:         135 ns/iter (+/- 0)

test multi_pin  ... bench:   4,173,010 ns/iter (+/- 389,623)
test single_pin ... bench:           5 ns/iter (+/- 0)

  • free-after-3 without validation
test multi_alloc_defer_free  ... bench:   4,140,581 ns/iter (+/- 426,444)
test multi_defer             ... bench:   2,160,064 ns/iter (+/- 196,742)
test single_alloc_defer_free ... bench:          43 ns/iter (+/- 0)
test single_defer            ... bench:          16 ns/iter (+/- 0)

test multi_flush  ... bench:  22,800,624 ns/iter (+/- 2,119,408)
test single_flush ... bench:         136 ns/iter (+/- 1)

test multi_pin  ... bench:   4,228,682 ns/iter (+/- 380,561)
test single_pin ... bench:           5 ns/iter (+/- 0)

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Thank you so much for fixing this! <3

@ghost
Copy link

ghost commented Nov 20, 2019

bors r+

@jeehoonkang
Copy link
Contributor

bors r-

@tomtomjhj and I figured out that actually #238 is not fixed by this commit... More discussion will come by @tomtomjhj soon.

@bors
Copy link
Contributor

bors bot commented Nov 20, 2019

Canceled

@jeehoonkang
Copy link
Contributor

Btw, I believe it's a good patch, though. I'm disapproving this PR to notify that it doesn't fix #238.

@tomtomjhj
Copy link
Contributor Author

#238 (comment)

@tomtomjhj tomtomjhj changed the title Require three epoch advancements for deallocation (fix #238) Require three epoch advancements for deallocation Jan 29, 2020
@xacrimon
Copy link

xacrimon commented Feb 8, 2020

Status on this?

@tomtomjhj
Copy link
Contributor Author

@xacrimon I made a new PR that fixes the queue itself #466.

@ghost
Copy link

ghost commented May 19, 2020

@jeehoonkang Do you think this needs to be merged? Let's make a decision.

@ghost ghost mentioned this pull request May 19, 2020
@jeehoonkang
Copy link
Contributor

I'd like to merge it because this PR streamlines the correctness argument of crossbeam-epoch.

bors r+

bors bot added a commit that referenced this pull request May 19, 2020
416: Require three epoch advancements for deallocation  r=jeehoonkang a=tomtomjhj

This patch implements the fix discussed in #238 (comment). 

* tag the Bag with the local epoch E
* free at E+3

Co-authored-by: Jeehoon Kang <jeehoon.kang@sf.snu.ac.kr>
@bors
Copy link
Contributor

bors bot commented May 19, 2020

Build failed:

@jeehoonkang
Copy link
Contributor

@ghost
Copy link

ghost commented May 20, 2020

Let's merge manually.

@ghost ghost merged commit 534be05 into crossbeam-rs:master May 20, 2020
bors bot added a commit that referenced this pull request May 25, 2020
517: Revert "Require three epoch advancements for deallocation " r=jeehoonkang a=jeehoonkang

Reverts #416

I'm suspecting may this PR causes #514.  Here's a revert PR, and I'd like to test if SIGSEGV is gone after reverting the PR...

Co-authored-by: Jeehoon Kang <jeehoon.kang@kaist.ac.kr>
exrook pushed a commit to exrook/crossbeam that referenced this pull request Oct 7, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants