knfsd: move tempsock aging to a timer
Subsystems (3)
PATCH 1/1 knfsd: move tempsock aging to a timer
knfsd: Move the aging of RPC/TCP connection sockets from the main svc_recv() loop to a timer which uses a mark-and-sweep algorithm every 6 minutes. This reduces the amount of work that needs to be done in the main RPC loop and the length of time we need to hold the (effectively global) svc_serv->sv_lock.
Signed-off-by Greg Banks <[email protected]>
---
include/linux/sunrpc/svc.h | 1 include/linux/sunrpc/svcsock.h | 2 net/sunrpc/svc.c | 3 net/sunrpc/svcsock.c | 96 +++++++++++++++++++++--------- 4 files changed, 76 insertions(+), 26 deletions(-)
include/linux/sunrpc/svc.h +1 -0
@@ -40,6 +40,7 @@ struct svc_serv {struct list_head sv_permsocks;/* all permanent sockets */ struct list_head sv_tempsocks;/* all temporary sockets */ int sv_tmpcnt;/* count of temporary sockets */ +struct timer_list sv_temptimer;/* timer for aging temporary sockets */ char * sv_name;/* service name */ };
include/linux/sunrpc/svcsock.h +2 -0
@@ -31,6 +31,8 @@ struct svc_sock {#define SK_DEAD 6/* socket closed */ #define SK_CHNGBUF 7/* need to change snd/rcv buffer sizes */ #define SK_DEFERRED 8/* request on sk_deferred */ +#define SK_OLD 9/* used for temp socket aging mark+sweep */ +#define SK_DETACHED 10/* detached from tempsocks list */ int sk_reserved;/* space on outq that is reserved */
net/sunrpc/svc.c +3 -0
@@ -57,6 +57,7 @@ svc_create(struct svc_program *prog, unsINIT_LIST_HEAD (&serv->sv_sockets);INIT_LIST_HEAD (&serv->sv_tempsocks);INIT_LIST_HEAD (&serv->sv_permsocks); +init_timer (&serv->sv_temptimer);spin_lock_init (&serv->sv_lock);/* Remove any stale portmap registrations */
@@ -85,6 +86,8 @@ svc_destroy(struct svc_serv *serv) }else printk ("svc_destroy: no threads for serv=%p!\n" , serv); +del_timer_sync (&serv->sv_temptimer); +while (!list_empty (&serv->sv_tempsocks)) { svsk = list_entry(serv->sv_tempsocks.next, struct svc_sock,
net/sunrpc/svcsock.c +70 -26
132 lines not on this page · raw message
Signature · 13 lines
Greg Banks, R&D Software Engineer, SGI Australian Software Group. I don't speak for SGI. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ NFS maillist - [email protected] https://lists.sourceforge.net/lists/listinfo/nfs