Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
2752e009
Commit
2752e009
authored
Nov 08, 2002
by
Chuck Lever
Committed by
Linus Torvalds
Nov 08, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] RTO estimator cleanup patch
clean up RPC client's RTO estimator.
parent
a7ec0168
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
8 deletions
+42
-8
include/linux/sunrpc/timer.h
include/linux/sunrpc/timer.h
+2
-2
include/linux/sunrpc/xprt.h
include/linux/sunrpc/xprt.h
+1
-1
net/sunrpc/timer.c
net/sunrpc/timer.c
+35
-3
net/sunrpc/xprt.c
net/sunrpc/xprt.c
+4
-2
No files found.
include/linux/sunrpc/timer.h
View file @
2752e009
...
...
@@ -20,8 +20,8 @@ struct rpc_rtt {
extern
void
rpc_init_rtt
(
struct
rpc_rtt
*
rt
,
unsigned
long
timeo
);
extern
void
rpc_update_rtt
(
struct
rpc_rtt
*
rt
,
int
timer
,
long
m
);
extern
unsigned
long
rpc_calc_rto
(
struct
rpc_rtt
*
rt
,
int
timer
);
extern
void
rpc_update_rtt
(
struct
rpc_rtt
*
rt
,
unsigned
timer
,
long
m
);
extern
unsigned
long
rpc_calc_rto
(
struct
rpc_rtt
*
rt
,
unsigned
timer
);
static
inline
void
rpc_inc_timeo
(
struct
rpc_rtt
*
rt
)
{
...
...
include/linux/sunrpc/xprt.h
View file @
2752e009
...
...
@@ -71,7 +71,7 @@ struct rpc_timeout {
to_initval
,
/* initial timeout */
to_maxval
,
/* max timeout */
to_increment
;
/* if !exponential */
short
to_retries
;
/* max # of retries */
unsigned
int
to_retries
;
/* max # of retries */
unsigned
char
to_exponential
;
};
...
...
net/sunrpc/timer.c
View file @
2752e009
/*
* linux/net/sunrpc/timer.c
*
* Estimate RPC request round trip time.
*
* Based on packet round-trip and variance estimator algorithms described
* in appendix A of "Congestion Avoidance and Control" by Van Jacobson
* and Michael J. Karels (ACM Computer Communication Review; Proceedings
* of the Sigcomm '88 Symposium in Stanford, CA, August, 1988).
*
* This RTT estimator is used only for RPC over datagram protocols.
*
* Copyright (C) 2002 Trond Myklebust <trond.myklebust@fys.uio.no>
*/
#include <asm/param.h>
#include <linux/version.h>
#include <linux/types.h>
#include <linux/unistd.h>
...
...
@@ -15,18 +32,25 @@ rpc_init_rtt(struct rpc_rtt *rt, unsigned long timeo)
{
unsigned
long
init
=
0
;
unsigned
i
;
rt
->
timeo
=
timeo
;
if
(
timeo
>
RPC_RTO_INIT
)
init
=
(
timeo
-
RPC_RTO_INIT
)
<<
3
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
rt
->
srtt
[
i
]
=
init
;
rt
->
sdrtt
[
i
]
=
RPC_RTO_INIT
;
}
atomic_set
(
&
rt
->
ntimeouts
,
0
);
}
/*
* NB: When computing the smoothed RTT and standard deviation,
* be careful not to produce negative intermediate results.
*/
void
rpc_update_rtt
(
struct
rpc_rtt
*
rt
,
int
timer
,
long
m
)
rpc_update_rtt
(
struct
rpc_rtt
*
rt
,
unsigned
timer
,
long
m
)
{
unsigned
long
*
srtt
,
*
sdrtt
;
...
...
@@ -36,16 +60,21 @@ rpc_update_rtt(struct rpc_rtt *rt, int timer, long m)
/* jiffies wrapped; ignore this one */
if
(
m
<
0
)
return
;
if
(
m
==
0
)
m
=
1
;
m
=
1L
;
srtt
=
&
rt
->
srtt
[
timer
];
m
-=
*
srtt
>>
3
;
*
srtt
+=
m
;
if
(
m
<
0
)
m
=
-
m
;
sdrtt
=
&
rt
->
sdrtt
[
timer
];
m
-=
*
sdrtt
>>
2
;
*
sdrtt
+=
m
;
/* Set lower bound on the variance */
if
(
*
sdrtt
<
RPC_RTO_MIN
)
*
sdrtt
=
RPC_RTO_MIN
;
...
...
@@ -65,13 +94,16 @@ rpc_update_rtt(struct rpc_rtt *rt, int timer, long m)
*/
unsigned
long
rpc_calc_rto
(
struct
rpc_rtt
*
rt
,
int
timer
)
rpc_calc_rto
(
struct
rpc_rtt
*
rt
,
unsigned
timer
)
{
unsigned
long
res
;
if
(
timer
--
==
0
)
return
rt
->
timeo
;
res
=
(
rt
->
srtt
[
timer
]
>>
3
)
+
rt
->
sdrtt
[
timer
];
if
(
res
>
RPC_RTO_MAX
)
res
=
RPC_RTO_MAX
;
return
res
;
}
net/sunrpc/xprt.c
View file @
2752e009
...
...
@@ -584,9 +584,11 @@ xprt_complete_rqst(struct rpc_xprt *xprt, struct rpc_rqst *req, int copied)
xprt_adjust_cwnd
(
xprt
,
copied
);
__xprt_put_cong
(
xprt
,
req
);
if
(
!
req
->
rq_nresend
)
{
int
timer
=
rpcproc_timer
(
clnt
,
task
->
tk_msg
.
rpc_proc
);
unsigned
timer
=
rpcproc_timer
(
clnt
,
task
->
tk_msg
.
rpc_proc
);
if
(
timer
)
rpc_update_rtt
(
&
clnt
->
cl_rtt
,
timer
,
(
long
)
jiffies
-
req
->
rq_xtime
);
rpc_update_rtt
(
&
clnt
->
cl_rtt
,
timer
,
(
long
)
jiffies
-
req
->
rq_xtime
);
}
rpc_clear_timeo
(
&
clnt
->
cl_rtt
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment