-
Notifications
You must be signed in to change notification settings - Fork 338
progcache: support concurrent usage #6653
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
Conversation
b353004
to
0fd9786
Compare
d6f483d
to
88dbee9
Compare
Performance Measurements ⏳
|
185c29a
to
11ac416
Compare
Performance Measurements ⏳
|
11ac416
to
4ee9125
Compare
Performance Measurements ⏳
|
4ee9125
to
f43e815
Compare
Performance Measurements ⏳
|
f43e815
to
d14cb67
Compare
Performance Measurements ⏳
|
d14cb67
to
f7f0ce2
Compare
Performance Measurements ⏳
|
f7f0ce2
to
4ea6c22
Compare
4ea6c22
to
a93634e
Compare
fd_progcache_load_fork_slow( cache, xid, epoch_slot0 ); /* switch fork */ | ||
} | ||
|
||
/* fd_progcache_query searches for a program cache entry on the current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stray comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no it's supposed to be there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, but it looks like you used the wrong function name in your documentation (should be fd_progcache_fork_has_xid
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment refers to the query routine overall, but some parts of query (like fork_has_xid) is split out into separate functions.
fd_progcache_rec_t * rec = fd_progcache_rec_new_nx( rec_mem, slot ); | ||
rec->invalidate = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats the purpose of having both invalidate
and executable
? can we use one or the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i understand correctly, its pretty much the equivalent of the last_modified_slot
and failed_verification
flags from the previous implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mjain-jump To be honest, I didn't really understand what "last_modified_slot" does, since it was zero most of the time.
invalidate
means: "This program was modified at the current fork graph node, you need to reload it in a future slot"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a list called programs_to_reverify
inside the txn ctx that gets amended every time fd_deploy_program
is called (for upgrades / deployments). in txn finalize we iterate over this list and set the last_slot_modified
field to the current slot for each of the cache entries. so i think yes it's pretty much equivalent to your invalidate
flag. what's the purpose of executable
in your PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the purpose of executable in your PR?
This is documented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entries are either non-executable (e.g. programs that failed
verification) or executable. Non-executable entry objects consist
only of this header struct. Executable entry objects are variable-
sized and contain additional structures past this header (rodata/ROM
segment, control flow metadata, ...).
[...]
uint executable : 1; /* is this an executable entry? */
bbbcd92
to
a1158ab
Compare
Performance Measurements ⏳
|
a1158ab
to
e1a6a4f
Compare
Performance Measurements ⏳
|
95a4fd9
to
c116f73
Compare
Performance Measurements ⏳
|
d8817a1
to
a71b8f8
Compare
Performance Measurements ⏳
|
a71b8f8
to
de1ca6c
Compare
Performance Measurements ⏳
|
- Reduce funk key size to 32 bytes (from 40 bytes) - Move program cache to separate funk instance and wksp - Restructure program cache logic / general cleanup - Reduce verbosity in API documentation - Clean up API naming - Split up API into a few smaller headers - Reduce program cache fill allocations and memory copies (directly populate calldests map, skip calldests map alloc for newer sBPF versions) - Remove broken/unused concurrency model in previous program cache implementation - Simplify cache invalidation logic ("queue program for re- verification"): now just inserts a tombstone - Reuse cache entries across forks (cache entries tracked at fork graph nodes determined by program modify slot, instead of program load slot) - Remove program pre-loading - Make program cache fills shared memory concurrent (in exec tiles)
de1ca6c
to
2a40eec
Compare
Performance Measurements ⏳
|
if( FD_UNLIKELY( (long)found_slot<best_slot ) ) continue; | ||
|
||
/* Confirm that record is part of the current fork | ||
FIXME this has bad performance / pointer-chasing */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can remove this FIXME, i actually addressed this problem
<tile name="exec"> | ||
<counter name="ProgcacheMisses" summary="Number of program cache misses" /> | ||
<counter name="ProgcacheHits" summary="Number of program cache hits" /> | ||
<counter name="ProgcacheFills" summary="Number of program cache insertions" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
split to enum?
ProgCacheInsertResult
- Success
- SuccessTombstone
- Duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do this and other suggestions discussed in chat in the next PR
No description provided.