-
Notifications
You must be signed in to change notification settings - Fork 327
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
interrupt opcode handling #15
Conversation
reqPool currently hosts both free and used requests, calling it reqUsed or reqPending would be misleading. If you don't like reqPool I could call it reqList.
doc/kernel.txt in libfuse at line 148 says this
libfuse, unless I'm reading it wrong, seems to put every interrupt request that can't be immediately be satisfied into a list and check every incoming request against the list of interrupted requests. To do the same we would have to guarantee that an interrupt request is fully processed before starting to process any other request and that all the requests prior to an interrupt request have at least been parsed before we process the interrupt request. It seems a big rework of the way go-fuse does things. Speaking of races...
actually yes, but not the way I was using it. I need it to know that a request has been parsed.
AFAIK there is no way to know that a channel is closed I would have to create a new channel for every request, regardless of whether it gets closed or not.
I'll get on it |
I take it back, there is a way:
Do you want to do it this way? |
About the sleep: sleeping in concurrent code is wrong almost by definition. How about the following:
For the management of the channel, how about the following: Rather than getInFlightMethod() which returns the wanted request, have a interruptRequest() method, taking the unique ID. If it can find the request to interrupt, it does the following:
On returning the request to the pool of free requests, replace the channel if req.wasInterrupted is set. Both actions should happen under protection by reqMu. I really don't want to have individual values on the interrupt channel; imagine one request that results in two goroutines being fired. You'd want the channel to be used for canceling both goroutines, and you can't do that by sending a single value. |
…d when the corrisponding request is processed
Have you seen my last two commits? Do they address your concerns? |
I saw them, but didn't realize they were already ready for consideration. On Thu, Jul 11, 2013 at 2:37 PM, Alessandro Arzilli <
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen |
I posted some comments. Also, I have been doing a lot of cleanup, so you'll On Thu, Jul 11, 2013 at 6:19 PM, Han-Wen Nienhuys hanwenn@gmail.com wrote:
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen |
- removed println - direct test that interrupt actually happened
Done
Pick what you like
Done
request structs need to be removed from reqFree immediately or multiple requests may use the same struct, however they don't contain valid data until the parsing is done. inUse signals the interrupt handling code that the data in a request is valid.
managing reqInflight is going to be O(n) on the fast path. BTW this is how the patch started (only with an inflight map that would be at least constant amortized on the fast path)
I don't think there is any expectation that an interrupt request will be fast. If this is really a concern a way to fix it would be compacting and shrinking the request pool on the fast path every nth request if the request pool is larger than m elements (but I have no way to tune this heuristic).
Will do. |
On Sun, Jul 14, 2013 at 8:15 PM, Alessandro Arzilli <
Can you experiment with this for some values? You can define a TTL, and
No. Here is how you do it: type request struct { when adding to the inflight list, r.index = len(server.inflight) when removing s.inflight[r.index] = s.inflight[len(s.inflight)-1]
Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen |
Update: commit e028a29e09 added INTERRUPT request handling by propagating it to closing |
No description provided.