[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fuse-devel
Subject:    Re: [fuse-devel] stat performance on multicore systems: measurements
From:       Miklos Szeredi <miklos () szeredi ! hu>
Date:       2012-07-30 15:21:49
Message-ID: 87y5m1i8aa.fsf () tucsk ! pomaz ! szeredi ! hu
[Download RAW message or body]

Stefan Westerfeld <stefan@space.twc.de> writes:

> The way I think it should work is that the FUSE fs will have different worker
> threads which are bound to one cpu per thread. If two processes running on cpu
> 1 and 3 access the filesystem, FUSE should use a worker thread bound to cpu 1
> to process requests from the userspace process running on cpu 1 and another
> worker thread bound to cpu 3 to process requests from the userspace process
> running on cpu 3.

Does the following patch help?

The wake_up_sync() call should prefer scheduling the woken up task on
the same CPU as the waker.

Thanks,
Miklos


diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 7df2b5e..f67071a 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -237,7 +237,8 @@ static u64 fuse_get_unique(struct fuse_conn *fc)
 	return fc->reqctr;
 }
 
-static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
+static void queue_request(struct fuse_conn *fc, struct fuse_req *req,
+			  bool sync_wakeup)
 {
 	req->in.h.len = sizeof(struct fuse_in_header) +
 		len_args(req->in.numargs, (struct fuse_arg *) req->in.args);
@@ -247,7 +248,10 @@ static void queue_request(struct fuse_conn *fc, struct fuse_req *req)
 		req->waiting = 1;
 		atomic_inc(&fc->num_waiting);
 	}
-	wake_up(&fc->waitq);
+	if (sync_wakeup)
+		wake_up_interruptible_sync(&fc->waitq);
+	else
+		wake_up(&fc->waitq);
 	kill_fasync(&fc->fasync, SIGIO, POLL_IN);
 }
 
@@ -279,7 +283,7 @@ static void flush_bg_queue(struct fuse_conn *fc)
 		list_del(&req->list);
 		fc->active_background++;
 		req->in.h.unique = fuse_get_unique(fc);
-		queue_request(fc, req);
+		queue_request(fc, req, false);
 	}
 }
 
@@ -417,7 +421,7 @@ void fuse_request_send(struct fuse_conn *fc, struct fuse_req *req)
 		req->out.h.error = -ECONNREFUSED;
 	else {
 		req->in.h.unique = fuse_get_unique(fc);
-		queue_request(fc, req);
+		queue_request(fc, req, true);
 		/* acquire extra reference, since request is still needed
 		   after request_end() */
 		__fuse_get_request(req);
@@ -472,7 +476,7 @@ static int fuse_request_send_notify_reply(struct fuse_conn *fc,
 	req->in.h.unique = unique;
 	spin_lock(&fc->lock);
 	if (fc->connected) {
-		queue_request(fc, req);
+		queue_request(fc, req, true);
 		err = 0;
 	}
 	spin_unlock(&fc->lock);

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
fuse-devel mailing list
fuse-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fuse-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic