public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* sid-20110801 Patch to fix multiple cache line aging
@ 2011-10-16  7:58 John Wehle
  2011-12-01 14:29 ` John Wehle
  0 siblings, 1 reply; 2+ messages in thread
From: John Wehle @ 2011-10-16  7:58 UTC (permalink / raw)
  To: sid

Currently the SID cache component references the same lru_replacement
object each time it creates a lru cache.  This causes configurations
with multiple caches (e.g. an Icache and Dcache) to use the same lru
array to track the line ages which creates problems since the array
no longer reflects the age of the lines in either cache.  Each cache
needs their own (private) lru array.

Based on code inspection it appears fifo_replacement suffers the same
problem.

The enclosed patch has been tested on FreeBSD with sid configured for
tomi Borealis (a processor under development by Venray Technology).

ChangeLog:

Sun Oct 16 00:16:46 EDT 2011  John Wehle  (john@feith.com)

	* component/cache/cache.cxx (CacheCreate):  Allocate a new
	replacement object each time for the fifo and lru types.

-- John
------------------------8<------------------------------8<---------------
--- component/cache/cache.cxx.ORIGINAL	2009-04-08 16:39:34.000000000 -0400
+++ component/cache/cache.cxx	2011-10-13 00:22:20.000000000 -0400
@@ -44,8 +44,6 @@ static string replacement_algorithms[] =
 
 // One per replacement policy
 static cache_replacement_null null_replacement;
-static cache_replacement_lru lru_replacement;
-static cache_replacement_fifo fifo_replacement;
 static cache_replacement_random random_replacement;
 static cache_line_factory internal_line_factory;
 static mep_assoc_replacement_algorithm mep_assoc_replacement;
@@ -1335,9 +1341,9 @@ CacheCreate (const string& typeName)
 	return new cache_component (assoc, cache_sz, line_sz, null_replacement, internal_line_factory);
   
       if (replace_alg_string == "lru")
-	return new cache_component (assoc, cache_sz, line_sz, lru_replacement, internal_line_factory);
+	return new cache_component (assoc, cache_sz, line_sz, *new cache_replacement_lru, internal_line_factory);
       else if (replace_alg_string == "fifo")
-	return new cache_component (assoc, cache_sz, line_sz, fifo_replacement, internal_line_factory);
+	return new cache_component (assoc, cache_sz, line_sz, *new cache_replacement_fifo, internal_line_factory);
       else if (replace_alg_string == "random")
 	return new cache_component (assoc, cache_sz, line_sz, random_replacement, internal_line_factory);
     }
@@ -1347,9 +1353,9 @@ CacheCreate (const string& typeName)
 	return new blocking_cache_component (assoc, cache_sz, line_sz, null_replacement, internal_line_factory);
   
       if (replace_alg_string == "lru")
-	return new blocking_cache_component (assoc, cache_sz, line_sz, lru_replacement, internal_line_factory);
+	return new blocking_cache_component (assoc, cache_sz, line_sz, *new cache_replacement_lru, internal_line_factory);
       else if (replace_alg_string == "fifo")
-	return new blocking_cache_component (assoc, cache_sz, line_sz, fifo_replacement, internal_line_factory);
+	return new blocking_cache_component (assoc, cache_sz, line_sz, *new cache_replacement_fifo, internal_line_factory);
       else if (replace_alg_string == "random")
 	return new blocking_cache_component (assoc, cache_sz, line_sz, random_replacement, internal_line_factory);
     }
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

* sid-20110801 Patch to fix multiple cache line aging
  2011-10-16  7:58 sid-20110801 Patch to fix multiple cache line aging John Wehle
@ 2011-12-01 14:29 ` John Wehle
  0 siblings, 0 replies; 2+ messages in thread
From: John Wehle @ 2011-12-01 14:29 UTC (permalink / raw)
  To: sid

Currently the SID cache component references the same lru_replacement
object each time it creates a lru cache.  This causes configurations
with multiple caches (e.g. an Icache and Dcache) to use the same lru
array to track the line ages which creates problems since the array
no longer reflects the age of the lines in either cache.  Each cache
needs their own (private) lru array.

Based on code inspection it appears fifo_replacement suffers the same
problem.

The enclosed patch has been tested on FreeBSD with sid configured for
tomi Borealis (a processor under development by Venray Technology).

ChangeLog:

Sun Oct 16 00:16:46 EDT 2011  John Wehle  (john@feith.com)

	* component/cache/cache.cxx (CacheCreate):  Allocate a new
	replacement object each time for the fifo and lru types.

-- John
------------------------8<------------------------------8<---------------
--- component/cache/cache.cxx.ORIGINAL	2009-04-08 16:39:34.000000000 -0400
+++ component/cache/cache.cxx	2011-10-13 00:22:20.000000000 -0400
@@ -44,8 +44,6 @@ static string replacement_algorithms[] =
 
 // One per replacement policy
 static cache_replacement_null null_replacement;
-static cache_replacement_lru lru_replacement;
-static cache_replacement_fifo fifo_replacement;
 static cache_replacement_random random_replacement;
 static cache_line_factory internal_line_factory;
 static mep_assoc_replacement_algorithm mep_assoc_replacement;
@@ -1335,9 +1341,9 @@ CacheCreate (const string& typeName)
 	return new cache_component (assoc, cache_sz, line_sz, null_replacement, internal_line_factory);
   
       if (replace_alg_string == "lru")
-	return new cache_component (assoc, cache_sz, line_sz, lru_replacement, internal_line_factory);
+	return new cache_component (assoc, cache_sz, line_sz, *new cache_replacement_lru, internal_line_factory);
       else if (replace_alg_string == "fifo")
-	return new cache_component (assoc, cache_sz, line_sz, fifo_replacement, internal_line_factory);
+	return new cache_component (assoc, cache_sz, line_sz, *new cache_replacement_fifo, internal_line_factory);
       else if (replace_alg_string == "random")
 	return new cache_component (assoc, cache_sz, line_sz, random_replacement, internal_line_factory);
     }
@@ -1347,9 +1353,9 @@ CacheCreate (const string& typeName)
 	return new blocking_cache_component (assoc, cache_sz, line_sz, null_replacement, internal_line_factory);
   
       if (replace_alg_string == "lru")
-	return new blocking_cache_component (assoc, cache_sz, line_sz, lru_replacement, internal_line_factory);
+	return new blocking_cache_component (assoc, cache_sz, line_sz, *new cache_replacement_lru, internal_line_factory);
       else if (replace_alg_string == "fifo")
-	return new blocking_cache_component (assoc, cache_sz, line_sz, fifo_replacement, internal_line_factory);
+	return new blocking_cache_component (assoc, cache_sz, line_sz, *new cache_replacement_fifo, internal_line_factory);
       else if (replace_alg_string == "random")
 	return new blocking_cache_component (assoc, cache_sz, line_sz, random_replacement, internal_line_factory);
     }
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-16  8:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-16  7:58 sid-20110801 Patch to fix multiple cache line aging John Wehle
2011-12-01 14:29 ` John Wehle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).