Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SUNRPC: Use RMW bitops in single-threaded hot paths

I noticed CPU pipeline stalls while using perf.

Once an svc thread is scheduled and executing an RPC, no other
processes will touch svc_rqst::rq_flags. Thus bus-locked atomics are
not needed outside the svc thread scheduler.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

+16 -15
+4 -3
fs/nfsd/nfs4proc.c
··· 970 970 * the client wants us to do more in this compound: 971 971 */ 972 972 if (!nfsd4_last_compound_op(rqstp)) 973 - clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags); 973 + __clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags); 974 974 975 975 /* check stateid */ 976 976 status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->current_fh, ··· 2650 2650 cstate->minorversion = args->minorversion; 2651 2651 fh_init(current_fh, NFS4_FHSIZE); 2652 2652 fh_init(save_fh, NFS4_FHSIZE); 2653 + 2653 2654 /* 2654 2655 * Don't use the deferral mechanism for NFSv4; compounds make it 2655 2656 * too hard to avoid non-idempotency problems. 2656 2657 */ 2657 - clear_bit(RQ_USEDEFERRAL, &rqstp->rq_flags); 2658 + __clear_bit(RQ_USEDEFERRAL, &rqstp->rq_flags); 2658 2659 2659 2660 /* 2660 2661 * According to RFC3010, this takes precedence over all other errors. ··· 2770 2769 out: 2771 2770 cstate->status = status; 2772 2771 /* Reset deferral mechanism for RPC deferrals */ 2773 - set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags); 2772 + __set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags); 2774 2773 return rpc_success; 2775 2774 } 2776 2775
+1 -1
fs/nfsd/nfs4xdr.c
··· 2411 2411 argp->rqstp->rq_cachetype = cachethis ? RC_REPLBUFF : RC_NOCACHE; 2412 2412 2413 2413 if (readcount > 1 || max_reply > PAGE_SIZE - auth_slack) 2414 - clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags); 2414 + __clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags); 2415 2415 2416 2416 return true; 2417 2417 }
+2 -2
net/sunrpc/auth_gss/svcauth_gss.c
··· 900 900 * rejecting the server-computed MIC in this somewhat rare case, 901 901 * do not use splice with the GSS integrity service. 902 902 */ 903 - clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags); 903 + __clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags); 904 904 905 905 /* Did we already verify the signature on the original pass through? */ 906 906 if (rqstp->rq_deferred) ··· 972 972 int pad, remaining_len, offset; 973 973 u32 rseqno; 974 974 975 - clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags); 975 + __clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags); 976 976 977 977 priv_len = svc_getnl(&buf->head[0]); 978 978 if (rqstp->rq_deferred) {
+3 -3
net/sunrpc/svc.c
··· 1244 1244 goto err_short_len; 1245 1245 1246 1246 /* Will be turned off by GSS integrity and privacy services */ 1247 - set_bit(RQ_SPLICE_OK, &rqstp->rq_flags); 1247 + __set_bit(RQ_SPLICE_OK, &rqstp->rq_flags); 1248 1248 /* Will be turned off only when NFSv4 Sessions are used */ 1249 - set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags); 1250 - clear_bit(RQ_DROPME, &rqstp->rq_flags); 1249 + __set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags); 1250 + __clear_bit(RQ_DROPME, &rqstp->rq_flags); 1251 1251 1252 1252 svc_putu32(resv, rqstp->rq_xid); 1253 1253
+1 -1
net/sunrpc/svc_xprt.c
··· 1238 1238 trace_svc_defer(rqstp); 1239 1239 svc_xprt_get(rqstp->rq_xprt); 1240 1240 dr->xprt = rqstp->rq_xprt; 1241 - set_bit(RQ_DROPME, &rqstp->rq_flags); 1241 + __set_bit(RQ_DROPME, &rqstp->rq_flags); 1242 1242 1243 1243 dr->handle.revisit = svc_revisit; 1244 1244 return &dr->handle;
+4 -4
net/sunrpc/svcsock.c
··· 298 298 static void svc_sock_secure_port(struct svc_rqst *rqstp) 299 299 { 300 300 if (svc_port_is_privileged(svc_addr(rqstp))) 301 - set_bit(RQ_SECURE, &rqstp->rq_flags); 301 + __set_bit(RQ_SECURE, &rqstp->rq_flags); 302 302 else 303 - clear_bit(RQ_SECURE, &rqstp->rq_flags); 303 + __clear_bit(RQ_SECURE, &rqstp->rq_flags); 304 304 } 305 305 306 306 /* ··· 1008 1008 rqstp->rq_xprt_ctxt = NULL; 1009 1009 rqstp->rq_prot = IPPROTO_TCP; 1010 1010 if (test_bit(XPT_LOCAL, &svsk->sk_xprt.xpt_flags)) 1011 - set_bit(RQ_LOCAL, &rqstp->rq_flags); 1011 + __set_bit(RQ_LOCAL, &rqstp->rq_flags); 1012 1012 else 1013 - clear_bit(RQ_LOCAL, &rqstp->rq_flags); 1013 + __clear_bit(RQ_LOCAL, &rqstp->rq_flags); 1014 1014 1015 1015 p = (__be32 *)rqstp->rq_arg.head[0].iov_base; 1016 1016 calldir = p[1];
+1 -1
net/sunrpc/xprtrdma/svc_rdma_transport.c
··· 602 602 603 603 static void svc_rdma_secure_port(struct svc_rqst *rqstp) 604 604 { 605 - set_bit(RQ_SECURE, &rqstp->rq_flags); 605 + __set_bit(RQ_SECURE, &rqstp->rq_flags); 606 606 } 607 607 608 608 static void svc_rdma_kill_temp_xprt(struct svc_xprt *xprt)