From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16313 invoked by alias); 16 Oct 2011 08:00:49 -0000 Received: (qmail 16304 invoked by uid 22791); 16 Oct 2011 08:00:48 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from feith1.FEITH.COM (HELO feith1.FEITH.COM) (192.251.93.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 16 Oct 2011 08:00:36 +0000 Received: from jwlab.FEITH.COM (jwlab.FEITH.COM [192.251.93.16]) by feith1.FEITH.COM (8.14.4+Sun/8.12.9) with ESMTP id p9G555xU021591 for ; Sun, 16 Oct 2011 01:05:05 -0400 (EDT) (envelope-from john@jwlab.FEITH.COM) Received: from jwlab.FEITH.COM (localhost [127.0.0.1]) by jwlab.FEITH.COM (8.14.4+Sun/8.14.4) with ESMTP id p9G555wF025590 for ; Sun, 16 Oct 2011 01:05:05 -0400 (EDT) Received: (from john@localhost) by jwlab.FEITH.COM (8.14.4+Sun/8.14.4/Submit) id p9G555gU025589 for sid@sources.redhat.com; Sun, 16 Oct 2011 01:05:05 -0400 (EDT) Date: Thu, 27 Oct 2011 04:16:00 -0000 From: John Wehle Message-ID: <201110160505.p9G555gU025589@jwlab.FEITH.COM> To: sid@sources.redhat.com Subject: sid-20110801 Patch to fix cache lru updating during expell MIME-Version: 1.0 Content-Type: text/plain X-DCC-dmv.com-Metrics: feith1; whitelist Mailing-List: contact sid-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: sid-owner@sourceware.org X-SW-Source: 2011-q4/txt/msg00004.txt.bz2 Message-ID: <20111027041600.q-vAuxdx9rMfkCy6QnW5shgQQWOylwalBzR7ydnE9UU@z> Currently when the SID cache lru component replaces a line it just sets the age of that line to zero without updating the age of any of the other lines. This means that if there are a series of cache misses, then there will be a series of new lines having the same age preventing the lru policy from being able to work correctly. 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:39:23 EDT 2011 John Wehle (john@feith.com) * component/cache/cache.cxx (cache_replacement_lru::expell): Update the age of all the lines. -- 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 @@ -1052,7 +1050,15 @@ cache_replacement_lru::expell (cache_set if (index < 0) return 0; - lru[index] = 0; + // update state by hand since the tag may not be set properly + for (unsigned i = 0; i < cset.num_lines (); i++) + { + if (i == index) + lru[i] = 0; + else + lru[i]++; + } + return &cset.get_line (index); } -------------------------------------------------------------------------