public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
From: John Wehle <john@feith.com>
To: sid@sources.redhat.com
Subject: sid-20110801 Patch to fix multiple cache line aging
Date: Thu, 01 Dec 2011 14:29:00 -0000	[thread overview]
Message-ID: <201110160504.p9G54N6p025582@jwlab.FEITH.COM> (raw)
Message-ID: <20111201142900.zFOWlV_dELW020bJWLUnUdfqgfu-J7YjOLFuS72DL8k@z> (raw)

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);
     }
-------------------------------------------------------------------------

             reply	other threads:[~2011-10-16  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-16  7:58 John Wehle [this message]
2011-12-01 14:29 ` John Wehle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201110160504.p9G54N6p025582@jwlab.FEITH.COM \
    --to=john@feith.com \
    --cc=sid@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).