You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by st...@locus.apache.org on 2000/07/05 21:40:53 UTC
cvs commit: apache-2.0/src/modules/mpm/winnt mpm_winnt.c
stoddard 00/07/05 12:40:50
Modified: src/include iol_socket.h
src/main iol_socket.c
src/modules/mpm/beos beos.c
src/modules/mpm/dexter dexter.c
src/modules/mpm/mpmt_beos mpmt_beos.c
src/modules/mpm/mpmt_pthread mpmt_pthread.c
src/modules/mpm/prefork prefork.c
src/modules/mpm/spmt_os2 spmt_os2.c
src/modules/mpm/winnt mpm_winnt.c
Log:
Allocate iols out of the ptrans pool rather than mallocing them out
of the heap. The extra malloc/free is a significant performance
hit on some platforms and repeatedly alloc/freeing small chunks of storage
can fragment the heap.
Revision Changes Path
1.2 +1 -1 apache-2.0/src/include/iol_socket.h
Index: iol_socket.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/include/iol_socket.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- iol_socket.h 2000/06/30 18:07:00 1.1
+++ iol_socket.h 2000/07/05 19:39:20 1.2
@@ -59,6 +59,6 @@
#ifndef OS_UNIX_IOL_SOCKET_H
#define OS_UNIX_IOL_SOCKET_H
-API_EXPORT(ap_iol *) ap_iol_attach_socket(ap_socket_t *sock);
+API_EXPORT(ap_iol *) ap_iol_attach_socket(ap_pool_t *p, ap_socket_t *sock);
#endif
1.3 +3 -3 apache-2.0/src/main/iol_socket.c
Index: iol_socket.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/iol_socket.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- iol_socket.c 2000/07/05 18:08:00 1.2
+++ iol_socket.c 2000/07/05 19:39:21 1.3
@@ -144,7 +144,6 @@
int saved_errno;
saved_errno = ap_close_socket(iol->sock);
- free(iol);
iol = NULL;
if (saved_errno == 0) {
return APR_SUCCESS;
@@ -170,11 +169,12 @@
socket_shutdown,
};
-API_EXPORT(ap_iol *) ap_iol_attach_socket(ap_socket_t *sock)
+API_EXPORT(ap_iol *) ap_iol_attach_socket(ap_pool_t *p, ap_socket_t *sock)
{
iol_socket *iol;
- iol = malloc(sizeof(iol_socket));
+ iol = ap_palloc(p, sizeof(iol_socket));
+
iol->iol.methods = &socket_methods;
iol->sock = sock;
return (ap_iol *)iol;
1.6 +1 -1 apache-2.0/src/modules/mpm/beos/beos.c
Index: beos.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/mpm/beos/beos.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- beos.c 2000/06/30 21:18:16 1.5
+++ beos.c 2000/07/05 19:39:29 1.6
@@ -388,7 +388,7 @@
return;
}
- iol = ap_iol_attach_socket(sock);
+ iol = ap_iol_attach_socket(p, sock);
if (iol == NULL) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL,
"error attaching to socket");
1.109 +1 -1 apache-2.0/src/modules/mpm/dexter/dexter.c
Index: dexter.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -r1.108 -r1.109
--- dexter.c 2000/07/05 18:01:12 1.108
+++ dexter.c 2000/07/05 19:39:43 1.109
@@ -504,7 +504,7 @@
}
sock_disable_nagle(csd);
- iol = ap_iol_attach_socket(sock);
+ iol = ap_iol_attach_socket(p, sock);
conn_io = ap_bcreate(p, B_RDWR);
ap_bpush_iol(conn_io, iol);
1.37 +1 -1 apache-2.0/src/modules/mpm/mpmt_beos/mpmt_beos.c
Index: mpmt_beos.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_beos/mpmt_beos.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- mpmt_beos.c 2000/06/30 21:18:25 1.36
+++ mpmt_beos.c 2000/07/05 19:39:53 1.37
@@ -365,7 +365,7 @@
long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num;
int csd;
- iol = ap_iol_attach_socket(sock);
+ iol = ap_iol_attach_socket(p, sock);
if (iol == NULL) {
if (errno == EBADF) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, errno, NULL,
1.103 +1 -1 apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c
Index: mpmt_pthread.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -r1.102 -r1.103
--- mpmt_pthread.c 2000/07/05 18:01:22 1.102
+++ mpmt_pthread.c 2000/07/05 19:40:04 1.103
@@ -499,7 +499,7 @@
sock_disable_nagle(csd);
- iol = ap_iol_attach_socket(sock);
+ iol = ap_iol_attach_socket(p, sock);
(void) ap_update_child_status(my_child_num, my_thread_num,
SERVER_BUSY_READ, (request_rec *) NULL);
1.113 +1 -1 apache-2.0/src/modules/mpm/prefork/prefork.c
Index: prefork.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- prefork.c 2000/06/30 18:07:29 1.112
+++ prefork.c 2000/07/05 19:40:14 1.113
@@ -1039,7 +1039,7 @@
sock_disable_nagle(sockdes);
- iol = ap_iol_attach_socket(csd);
+ iol = ap_iol_attach_socket(ptrans, csd);
(void) ap_update_child_status(my_child_num, SERVER_BUSY_READ,
(request_rec *) NULL);
1.49 +1 -1 apache-2.0/src/modules/mpm/spmt_os2/spmt_os2.c
Index: spmt_os2.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/mpm/spmt_os2/spmt_os2.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- spmt_os2.c 2000/06/30 18:07:35 1.48
+++ spmt_os2.c 2000/07/05 19:40:32 1.49
@@ -994,7 +994,7 @@
sock_disable_nagle(csd);
- iol = ap_iol_attach_socket(csd);
+ iol = ap_iol_attach_socket(ptrans, csd);
if (iol == NULL) {
ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, NULL,
1.83 +1 -1 apache-2.0/src/modules/mpm/winnt/mpm_winnt.c
Index: mpm_winnt.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/mpm/winnt/mpm_winnt.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- mpm_winnt.c 2000/06/30 18:07:39 1.82
+++ mpm_winnt.c 2000/07/05 19:40:39 1.83
@@ -1085,7 +1085,7 @@
sock_disable_nagle(context->accept_socket);
ap_put_os_sock(&context->sock, &context->accept_socket, context->ptrans);
- iol = ap_iol_attach_socket(context->sock);
+ iol = ap_iol_attach_socket(context->ptrans, context->sock);
if (iol == NULL) {
ap_log_error(APLOG_MARK, APLOG_ERR, APR_ENOMEM, server_conf,
"worker_main: attach_socket() failed. Continuing...");