[tor-commits] [tor/master] Rename MaxMemInCellQueues to MaxMemInQueues
nickm at torproject.org
nickm at torproject.org
Tue Mar 4 16:04:42 UTC 2014
commit e572ec856dff263d7f43ec6d42fe3fc3b7557f73
Author: Nick Mathewson <nickm at torproject.org>
Date: Wed Nov 20 12:08:14 2013 -0500
Rename MaxMemInCellQueues to MaxMemInQueues
---
doc/tor.1.txt | 10 +++++-----
src/or/circuitlist.c | 10 +++++-----
src/or/config.c | 9 +++++----
src/or/or.h | 5 ++---
src/or/relay.c | 2 +-
5 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 1f3afef..01f0be7 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -1475,13 +1475,13 @@ is non-zero):
localhost, RFC1918 addresses, and so on. This can create security issues;
you should probably leave it off. (Default: 0)
-**MaxMemInCellQueues** __N__ **bytes**|**KB**|**MB**|**GB**::
+**MaxMemInQueues** __N__ **bytes**|**KB**|**MB**|**GB**::
This option configures a threshold above which Tor will assume that it
- needs to stop queueing cells because it's about to run out of memory.
- If it hits this threshold, it will begin killing circuits until it
- has recovered at least 10% of this memory. Do not set this option too
+ needs to stop queueing or buffering data because it's about to run out of
+ memory. If it hits this threshold, it will begin killing circuits until
+ it has recovered at least 10% of this memory. Do not set this option too
low, or your relay may be unreliable under load. This option only
- effects circuit queues, so the actual process size will be larger than
+ affects some queues, so the actual process size will be larger than
this. (Default: 8GB)
DIRECTORY SERVER OPTIONS
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 3237b1e..2e13541 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -1512,11 +1512,11 @@ circuits_compare_by_oldest_queued_item_(const void **a_, const void **b_)
return -1;
}
-#define FRACTION_OF_CELLS_TO_RETAIN_ON_OOM 0.90
+#define FRACTION_OF_DATA_TO_RETAIN_ON_OOM 0.90
/** We're out of memory for cells, having allocated <b>current_allocation</b>
* bytes' worth. Kill the 'worst' circuits until we're under
- * FRACTION_OF_CIRCS_TO_RETAIN_ON_OOM of our maximum usage. */
+ * FRACTION_OF_DATA_TO_RETAIN_ON_OOM of our maximum usage. */
void
circuits_handle_oom(size_t current_allocation)
{
@@ -1530,11 +1530,11 @@ circuits_handle_oom(size_t current_allocation)
uint32_t now_ms;
log_notice(LD_GENERAL, "We're low on memory. Killing circuits with "
"over-long queues. (This behavior is controlled by "
- "MaxMemInCellQueues.)");
+ "MaxMemInQueues.)");
{
- size_t mem_target = (size_t)(get_options()->MaxMemInCellQueues *
- FRACTION_OF_CELLS_TO_RETAIN_ON_OOM);
+ size_t mem_target = (size_t)(get_options()->MaxMemInQueues *
+ FRACTION_OF_DATA_TO_RETAIN_ON_OOM);
if (current_allocation <= mem_target)
return;
mem_to_recover = current_allocation - mem_target;
diff --git a/src/or/config.c b/src/or/config.c
index d5c5689..0accb65 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -115,6 +115,7 @@ static config_abbrev_t _option_abbrevs[] = {
{ "BandwidthBurstBytes", "BandwidthBurst", 0, 0},
{ "DirFetchPostPeriod", "StatusFetchPeriod", 0, 0},
{ "MaxConn", "ConnLimit", 0, 1},
+ { "MaxMemInCellQueues", "MaxMemInQueues", 0, 0},
{ "ORBindAddress", "ORListenAddress", 0, 0},
{ "DirBindAddress", "DirListenAddress", 0, 0},
{ "SocksBindAddress", "SocksListenAddress", 0, 0},
@@ -343,7 +344,7 @@ static config_var_t _option_vars[] = {
V(MaxAdvertisedBandwidth, MEMUNIT, "1 GB"),
V(MaxCircuitDirtiness, INTERVAL, "10 minutes"),
V(MaxClientCircuitsPending, UINT, "32"),
- V(MaxMemInCellQueues, MEMUNIT, "8 GB"),
+ V(MaxMemInQueues, MEMUNIT, "8 GB"),
V(MaxOnionsPending, UINT, "100"),
OBSOLETE("MonthlyAccountingStart"),
V(MyFamily, STRING, NULL),
@@ -3669,10 +3670,10 @@ options_validate(or_options_t *old_options, or_options_t *options,
log_warn(LD_CONFIG, "EntryNodes is set, but UseEntryGuards is disabled. "
"EntryNodes will be ignored.");
- if (options->MaxMemInCellQueues < (500 << 20)) {
- log_warn(LD_CONFIG, "MaxMemInCellQueues must be at least 500 MB for now. "
+ if (options->MaxMemInQueues < (500 << 20)) {
+ log_warn(LD_CONFIG, "MaxMemInQueues must be at least 500 MB for now. "
"Ideally, have it as large as you can afford.");
- options->MaxMemInCellQueues = (500 << 20);
+ options->MaxMemInQueues = (500 << 20);
}
options->_AllowInvalid = 0;
diff --git a/src/or/or.h b/src/or/or.h
index 0dd47d0..c323783 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3075,9 +3075,8 @@ typedef struct {
config_line_t *DirPort_lines;
config_line_t *DNSPort_lines; /**< Ports to listen on for DNS requests. */
- uint64_t MaxMemInCellQueues; /**< If we have more memory than this allocated
- * for circuit cell queues, run the OOM handler
- */
+ uint64_t MaxMemInQueues; /**< If we have more memory than this allocated
+ * for queues and buffers, run the OOM handler */
/** @name port booleans
*
diff --git a/src/or/relay.c b/src/or/relay.c
index 042fc18..e6d0f50 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1999,7 +1999,7 @@ cell_queues_check_size(void)
{
size_t alloc = total_cells_allocated * packed_cell_mem_cost();
alloc += buf_get_total_allocation();
- if (alloc >= get_options()->MaxMemInCellQueues) {
+ if (alloc >= get_options()->MaxMemInQueues) {
circuits_handle_oom(alloc);
return 1;
}
More information about the tor-commits
mailing list