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

feat(prefetch): add pg #59

Merged
merged 1 commit into from
Feb 22, 2024
Merged

feat(prefetch): add pg #59

merged 1 commit into from
Feb 22, 2024

Conversation

zztaki
Copy link
Contributor

@zztaki zztaki commented Feb 21, 2024

I have reconstructed the PG prefetching algorithm, and it is worth mentioning that I use direct_hash for all hashtables, which means that I used GINT_TO_POINTER and GPOINTER_TO_INT to convert obj_id or obj_size as the key or the value. Compared to g_int64_hash, this can reduce the overhead of allocation, dereference, and memory release.

Maybe there is a problem on a 32 bit machine, where long and void* maybe are both 4 bytes. :(

Signed-off-by: zztaki <zztaki@outlook.com>
if (prefetch_list) {
GList *node = prefetch_list;
request_t *new_req = my_malloc(request_t);
memcpy(new_req, req, sizeof(request_t));
Copy link
Owner

Choose a reason for hiding this comment

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

it might be better to use copy_request if we plan to add some tracking when a request is copied

static inline void copy_request(request_t *req_dest, request_t *req_src) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good suggestion!

@1a1a11a
Copy link
Owner

1a1a11a commented Feb 21, 2024

I would not worry about the 32-bit issue. It would be good to add some documentation on how to use the prefetching algorithm (maybe a few lines in the cachesim.md and a separate prefetch.md documentation).

@1a1a11a
Copy link
Owner

1a1a11a commented Feb 21, 2024

If you want to add the documentation after finishing everything, it is fine as well. :)

@zztaki
Copy link
Contributor Author

zztaki commented Feb 22, 2024

If you want to add the documentation after finishing everything, it is fine as well. :)

Yes, I am glad to add the documentations! :)

Do you mind if I create a few PRs later to add documents related to admission and prefetching? Probably within ten hours. 😄

@1a1a11a
Copy link
Owner

1a1a11a commented Feb 22, 2024

Sounds good! I will merge this PR for now. :)

@1a1a11a 1a1a11a merged commit e075986 into 1a1a11a:develop Feb 22, 2024
2 checks passed
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.

None yet

2 participants