History

SUNRPC: Remove the .svo_enqueue_xprt method

We have never been able to track down and address the underlying cause of the performance issues with workqueue-based service support. svo_enqueue_xprt is called multiple times per RPC, so it adds instruction path length, but always ends up at the same function: svc_xprt_do_enqueue(). We do not anticipate needing this flexibility for dynamic nfsd thread management support. As a micro-optimization, remove .svo_enqueue_xprt because Spectre/Meltdown makes virtual function calls more costly. This change essentially reverts commit b9e13cdfac70 ("nfsd/sunrpc: turn enqueueing a svc_xprt into a svc_serv operation").

Chuck Lever committed 4 years ago

Commit a9ff2e91 parent 70a60cb6 files · +5 −13Browse files

Unified · Split

6 files
  1. fs/lockd/svc.c +0 −1
  2. fs/nfs/callback.c +0 −2
  3. fs/nfsd/nfssvc.c +0 −1
  4. include/linux/sunrpc/svc.h +0 −3
  5. include/linux/sunrpc/svc_xprt.h +0 −1
  6. net/sunrpc/svc_xprt.c +5 −5
fs/lockd/svc.c+0−1
@@ -353,7 +353,6 @@ static struct notifier_block lockd_inet6addr_notifier = { · 352 unmodified lines
353353 static const struct svc_serv_ops lockd_sv_ops = {
354354 .svo_shutdown = svc_rpcb_cleanup,
355355 .svo_function = lockd,
356− .svo_enqueue_xprt = svc_xprt_do_enqueue,
357356 .svo_module = THIS_MODULE,
358357 };
359358
fs/nfs/callback.c+0−2
@@ -234,13 +234,11 @@ err_bind: · 233 unmodified lines
234234
235235 static const struct svc_serv_ops nfs40_cb_sv_ops = {
236236 .svo_function = nfs4_callback_svc,
237− .svo_enqueue_xprt = svc_xprt_do_enqueue,
238237 .svo_module = THIS_MODULE,
239238 };
240239 #if defined(CONFIG_NFS_V4_1)
241240 static const struct svc_serv_ops nfs41_cb_sv_ops = {
242241 .svo_function = nfs41_callback_svc,
243− .svo_enqueue_xprt = svc_xprt_do_enqueue,
244242 .svo_module = THIS_MODULE,
245243 };
246244
fs/nfsd/nfssvc.c+0−1
@@ -615,7 +615,6 @@ static int nfsd_get_default_max_blksize(void) · 614 unmodified lines
615615 static const struct svc_serv_ops nfsd_thread_sv_ops = {
616616 .svo_shutdown = nfsd_last_thread,
617617 .svo_function = nfsd,
618− .svo_enqueue_xprt = svc_xprt_do_enqueue,
619618 .svo_module = THIS_MODULE,
620619 };
621620
include/linux/sunrpc/svc.h+0−3
@@ -61,9 +61,6 @@ struct svc_serv_ops { · 60 unmodified lines
6161 /* function for service threads to run */
6262 int (*svo_function)(void *);
6363
64− /* queue up a transport for servicing */
65− void (*svo_enqueue_xprt)(struct svc_xprt *);
66−
6764 /* optional module to count when adding threads.
6865 * Thread function must call module_put_and_kthread_exit() to exit.
6966 */
include/linux/sunrpc/svc_xprt.h+0−1
@@ -131,7 +131,6 @@ int svc_create_xprt(struct svc_serv *, const char *, struct net *, · 130 unmodified lines
131131 const int, const unsigned short, int,
132132 const struct cred *);
133133 void svc_xprt_received(struct svc_xprt *xprt);
134−void svc_xprt_do_enqueue(struct svc_xprt *xprt);
135134 void svc_xprt_enqueue(struct svc_xprt *xprt);
136135 void svc_xprt_put(struct svc_xprt *xprt);
137136 void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt);
net/sunrpc/svc_xprt.c+5−5
@@ -32,6 +32,7 @@ static int svc_deferred_recv(struct svc_rqst *rqstp); · 31 unmodified lines
3232 static struct cache_deferred_req *svc_defer(struct cache_req *req);
3333 static void svc_age_temp_xprts(struct timer_list *t);
3434 static void svc_delete_xprt(struct svc_xprt *xprt);
35+static void svc_xprt_do_enqueue(struct svc_xprt *xprt);
3536
3637 /* apparently the "standard" is that clients close
3738 * idle connections after 5 minutes, servers after
@@ -266,12 +267,12 @@ void svc_xprt_received(struct svc_xprt *xprt) · 228 unmodified lines
266267 }
267268
268269 /* As soon as we clear busy, the xprt could be closed and
269− * 'put', so we need a reference to call svc_enqueue_xprt with:
270+ * 'put', so we need a reference to call svc_xprt_do_enqueue with:
270271 */
271272 svc_xprt_get(xprt);
272273 smp_mb__before_atomic();
273274 clear_bit(XPT_BUSY, &xprt->xpt_flags);
274− xprt->xpt_server->sv_ops->svo_enqueue_xprt(xprt);
275+ svc_xprt_do_enqueue(xprt);
275276 svc_xprt_put(xprt);
276277 }
277278 EXPORT_SYMBOL_GPL(svc_xprt_received);
@@ -423,7 +424,7 @@ static bool svc_xprt_ready(struct svc_xprt *xprt) · 145 unmodified lines
423424 return false;
424425 }
425426
426−void svc_xprt_do_enqueue(struct svc_xprt *xprt)
427+static void svc_xprt_do_enqueue(struct svc_xprt *xprt)
427428 {
428429 struct svc_pool *pool;
429430 struct svc_rqst *rqstp = NULL;
@@ -467,7 +468,6 @@ out_unlock: · 37 unmodified lines
467468 put_cpu();
468469 trace_svc_xprt_enqueue(xprt, rqstp);
469470 }
470−EXPORT_SYMBOL_GPL(svc_xprt_do_enqueue);
471471
472472 /*
473473 * Queue up a transport with data pending. If there are idle nfsd
@@ -478,7 +478,7 @@ void svc_xprt_enqueue(struct svc_xprt *xprt) · 4 unmodified lines
478478 {
479479 if (test_bit(XPT_BUSY, &xprt->xpt_flags))
480480 return;
481− xprt->xpt_server->sv_ops->svo_enqueue_xprt(xprt);
481+ svc_xprt_do_enqueue(xprt);
482482 }
483483 EXPORT_SYMBOL_GPL(svc_xprt_enqueue);
484484

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t