Skip to content

Revise CachePadded #130

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

Closed
wants to merge 1 commit into from
Closed

Conversation

jeehoonkang
Copy link
Contributor

Here are the changes I made:

Remaining questions:

  • Is it better to describe the cache line size as CONST * sizeof(usize)? Why not just write down the size in bytes?

  • I think eventually CACHE_LINE should depend on the (micro-)architecture. But I cannot find any existing C/C++ library on it. Do anyone have an idea/pointer on this?

    Alternatively, we can get the cache line size from the environmental variable, with 64 bytes as default.

  • How to support T whose size is bigger than CACHE_LINE? It is needed when we want the cache line size to be 64 bytes, as sizeof(Participant) > 64.

Copy link

@arthurprs arthurprs left a comment

Choose a reason for hiding this comment

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

Seems strictly better than what we have 👍

#[derive(Debug)]
struct Padding(u64, u64, u64, u64);
struct Padding([usize; CACHE_LINE]);

Choose a reason for hiding this comment

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

We need to make it u/i/XX in order to compile on nightly.

@Vtec234
Copy link
Member

Vtec234 commented Apr 22, 2017

A heads up, the alignment feature (rust-lang/rust#39999) just landed and should be available on nightly soon :)

@jeehoonkang
Copy link
Contributor Author

Closing it, as crossbeam-utils implements a new version of CachePadded.

@jeehoonkang jeehoonkang deleted the cachepadded branch June 2, 2019 05:27
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.

3 participants