Skip to content

Commit a9ff2e9

Browse files
committed
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 b9e13cd ("nfsd/sunrpc: turn enqueueing a svc_xprt into a svc_serv operation"). Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 70a60cb commit a9ff2e9

6 files changed

Lines changed: 5 additions & 13 deletions

File tree

fs/lockd/svc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ static struct notifier_block lockd_inet6addr_notifier = {
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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,11 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv,
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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,6 @@ static int nfsd_get_default_max_blksize(void)
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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ struct svc_serv_ops {
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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ int svc_create_xprt(struct svc_serv *, const char *, struct net *,
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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ static int svc_deferred_recv(struct svc_rqst *rqstp);
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)
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)
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 @@ void svc_xprt_do_enqueue(struct svc_xprt *xprt)
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)
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

0 commit comments

Comments
 (0)