You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/09/22 15:23:37 UTC

svn commit: r1388807 - in /subversion/branches/10Gb/subversion/libsvn_ra_svn: marshal.c ra_svn.h

Author: stefan2
Date: Sat Sep 22 13:23:37 2012
New Revision: 1388807

URL: http://svn.apache.org/viewvc?rev=1388807&view=rev
Log:
On the 10Gb branch: make the I/O buffers page-aligned.  On some
systems, that may improve throughput.

* subversion/libsvn_ra_svn/ra_svn.h
  (SVN_RA_SVN__PAGE_SIZE): define our assumed page size
  (SVN_RA_SVN__READBUF_SIZE,
   SVN_RA_SVN__WRITEBUF_SIZE): define in terms of pages
  (svn_ra_svn_conn_st): move I/O buffers to offsets that are
   multiples of the page size

* subversion/libsvn_ra_svn/marshal.c
  (svn_ra_svn_create_conn3): align conn to page boundary
  (writebuf_write): sending everything >= 2 pages directly.

Modified:
    subversion/branches/10Gb/subversion/libsvn_ra_svn/marshal.c
    subversion/branches/10Gb/subversion/libsvn_ra_svn/ra_svn.h

Modified: subversion/branches/10Gb/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/subversion/libsvn_ra_svn/marshal.c?rev=1388807&r1=1388806&r2=1388807&view=diff
==============================================================================
--- subversion/branches/10Gb/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/10Gb/subversion/libsvn_ra_svn/marshal.c Sat Sep 22 13:23:37 2012
@@ -64,7 +64,9 @@ svn_ra_svn_conn_t *svn_ra_svn_create_con
                                            apr_size_t error_check_interval,
                                            apr_pool_t *pool)
 {
-  svn_ra_svn_conn_t *conn = apr_palloc(pool, sizeof(*conn));
+  svn_ra_svn_conn_t *conn;
+  void *mem = apr_palloc(pool, sizeof(*conn) + SVN_RA_SVN__PAGE_SIZE);
+  conn = (void*)APR_ALIGN((apr_uintptr_t)mem, SVN_RA_SVN__PAGE_SIZE);
 
   assert((sock && !in_file && !out_file) || (!sock && in_file && out_file));
 #ifdef SVN_HAVE_SASL
@@ -257,11 +259,12 @@ static svn_error_t *writebuf_write(svn_r
 {
   const char *end = data + len;
 
-  /* data > 4k is sent immediately */
-  if (len >= sizeof(conn->write_buf) / 4)
+  /* data >= 8k is sent immediately */
+  if (len >= sizeof(conn->write_buf) / 2)
     {
       if (conn->write_pos > 0)
         SVN_ERR(writebuf_flush(conn, pool));
+      
       return writebuf_output(conn, pool, data, len);
     }
 

Modified: subversion/branches/10Gb/subversion/libsvn_ra_svn/ra_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/10Gb/subversion/libsvn_ra_svn/ra_svn.h?rev=1388807&r1=1388806&r2=1388807&view=diff
==============================================================================
--- subversion/branches/10Gb/subversion/libsvn_ra_svn/ra_svn.h (original)
+++ subversion/branches/10Gb/subversion/libsvn_ra_svn/ra_svn.h Sat Sep 22 13:23:37 2012
@@ -57,8 +57,9 @@ typedef svn_error_t *(*ra_svn_block_hand
                                                void *baton);
 
 /* The size of our per-connection read and write buffers. */
-#define SVN_RA_SVN__READBUF_SIZE (4*4096)
-#define SVN_RA_SVN__WRITEBUF_SIZE (4*4096)
+#define SVN_RA_SVN__PAGE_SIZE 4096
+#define SVN_RA_SVN__READBUF_SIZE (4 * SVN_RA_SVN__PAGE_SIZE)
+#define SVN_RA_SVN__WRITEBUF_SIZE (4 * SVN_RA_SVN__PAGE_SIZE)
 
 /* Create forward reference */
 typedef struct svn_ra_svn__session_baton_t svn_ra_svn__session_baton_t;
@@ -66,6 +67,14 @@ typedef struct svn_ra_svn__session_baton
 /* This structure is opaque to the server.  The client pokes at the
  * first few fields during setup and cleanup. */
 struct svn_ra_svn_conn_st {
+
+  /* I/O buffers */
+  char write_buf[SVN_RA_SVN__WRITEBUF_SIZE];
+  char read_buf[SVN_RA_SVN__READBUF_SIZE];
+  char *read_ptr;
+  char *read_end;
+  apr_size_t write_pos;
+
   svn_ra_svn__stream_t *stream;
   svn_ra_svn__session_baton_t *session;
 #ifdef SVN_HAVE_SASL
@@ -76,13 +85,6 @@ struct svn_ra_svn_conn_st {
   svn_boolean_t encrypted;
 #endif
 
-  /* I/O buffers */
-  char read_buf[SVN_RA_SVN__READBUF_SIZE];
-  char *read_ptr;
-  char *read_end;
-  char write_buf[SVN_RA_SVN__WRITEBUF_SIZE];
-  apr_size_t write_pos;
-
   /* abortion check control */
   apr_size_t written_since_error_check;
   apr_size_t error_check_interval;