Message ID | 153303273523.387.7541221195413649436.stgit@localhost.localdomain (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fuse: Small cleanup series | expand |
On Tue, Jul 31, 2018 at 12:25 PM, Kirill Tkhai <ktkhai@virtuozzo.com> wrote: > Nobody can clear FR_BACKGROUND bit on processing > request in parallel, so it's possible to do it > out of fc->lock. Moving such a cheap operation outside the splinlock won't make any difference in real life. And anyway the biggest problem with fc->lock is not contention (hold for long period of time), I would guess, but cachline pingponging (being acquired on different CPUs one after the other). So there's definitely work to do regarding locking in fuse, but it needs a bigger axe. Thanks, Miklos
On 07.08.2018 15:22, Miklos Szeredi wrote: > On Tue, Jul 31, 2018 at 12:25 PM, Kirill Tkhai <ktkhai@virtuozzo.com> wrote: >> Nobody can clear FR_BACKGROUND bit on processing >> request in parallel, so it's possible to do it >> out of fc->lock. > > Moving such a cheap operation outside the splinlock won't make any > difference in real life. It's not about difference in real life, it's about readability. Testing the bit outside the lock and clearing it inside the lock confuses a reader, and makes he to thing there is a tricky synchronization, while there is no tricky synchronization. > And anyway the biggest problem with fc->lock is not contention (hold > for long period of time), I would guess, but cachline pingponging > (being acquired on different CPUs one after the other). > > So there's definitely work to do regarding locking in fuse, but it > needs a bigger axe. I've moved background stuff at a separate lock in my sandbox tree, and this was pretty easy. Not yet sent to you, since I'm going to do some performance testing on this. I've locked for tests used to measure the performance in fuse git log, but there is no one pointing in the log I found. Could you tell, what fuse driver do you use to measure performance and which test you use? Kirill
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 214ce96b1d26..ce07a41ff8fe 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -390,8 +390,8 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) WARN_ON(test_bit(FR_PENDING, &req->flags)); WARN_ON(test_bit(FR_SENT, &req->flags)); if (test_bit(FR_BACKGROUND, &req->flags)) { - spin_lock(&fc->lock); clear_bit(FR_BACKGROUND, &req->flags); + spin_lock(&fc->lock); if (fc->num_background == fc->max_background) fc->blocked = 0;
Nobody can clear FR_BACKGROUND bit on processing request in parallel, so it's possible to do it out of fc->lock. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> --- fs/fuse/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)