Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4336 - trunk/src/os/unix

Anonymous User
December 11, 2011 11:32AM
Author: mdounin
Date: 2011-12-11 16:30:42 +0000 (Sun, 11 Dec 2011)
New Revision: 4336

Log:
Microoptimization of sendfile(2) usage under FreeBSD.

FreeBSD kernel checks headers/trailers pointer against NULL, not
corresponding count. Passing NULL if there are no headers/trailers
helps to avoid unneeded work in kernel, as well as unexpected 0 bytes
GIO in traces.


Modified:
trunk/src/os/unix/ngx_freebsd_sendfile_chain.c

Modified: trunk/src/os/unix/ngx_freebsd_sendfile_chain.c
===================================================================
--- trunk/src/os/unix/ngx_freebsd_sendfile_chain.c 2011-12-09 16:17:12 UTC (rev 4335)
+++ trunk/src/os/unix/ngx_freebsd_sendfile_chain.c 2011-12-11 16:30:42 UTC (rev 4336)
@@ -246,9 +246,14 @@
}
}

- hdtr.headers = (struct iovec *) header.elts;
+ /*
+ * sendfile() does unneeded work if sf_hdtr's count is 0,
+ * but corresponding pointer is not NULL
+ */
+
+ hdtr.headers = header.nelts ? (struct iovec *) header.elts: NULL;
hdtr.hdr_cnt = header.nelts;
- hdtr.trailers = (struct iovec *) trailer.elts;
+ hdtr.trailers = trailer.nelts ? (struct iovec *) trailer.elts: NULL;
hdtr.trl_cnt = trailer.nelts;

/*

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4336 - trunk/src/os/unix

Anonymous User 1627 December 11, 2011 11:32AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 223
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready