public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Sean Paul <seanpaul@chromium.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] dim: Try to gc the rr-cache
Date: Fri, 14 Jul 2017 12:57:23 +0300	[thread overview]
Message-ID: <87379zl4sc.fsf@nikula.org> (raw)
In-Reply-To: <20170713201639.pybaxyz6wbub7qky@art_vandelay>

On Thu, 13 Jul 2017, Sean Paul <seanpaul@chromium.org> wrote:
> On Wed, Jul 12, 2017 at 02:12:24PM +0200, Daniel Vetter wrote:
>> The problem is that we have a distributed cache - every committer has
>> a copy. Which means even just a slight clock skew will make sure that
>> a naive gc algorithm results in lots of thrashing around.
>> 
>> To fix this add a huge hysteresis: Only add files newer than 1 day,
>> and only remove them when older than 60 days. As long as people have
>> reasonable accurate clocks on their machines this should work.
>> 
>> A different problem is that we can't use filesystem timestamps (and
>> hence can't use git rerere gc): When someone comes back from vacations
>> and updates git rerere, all the files will have current timestamps,
>> even when they've been pushed out weeks ago. To fix that, use the git
>> log to judge old files to remove. Also, remove old files before adding
>> new ones, to avoid confusion.
>> 
>> Also, we need to teach the cp -r to preserve timestamps, otherwise
>> this won't work.
>> 
>> v2: Use git log to remove old files.
>> 
>> v3: Remove the debug uncommenting (Sean).
>> 
>> v4: Split out code movement and explain better what's going on (Jani).
>
> Yeah, much easier to digest with the split.
>
> Reviewed-by: Sean Paul <seanpaul@chromium.org>

I'll trust that and hope for the best. ;)

BR,
Jani.


>
>> 
>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>> ---
>>  dim | 10 ++++++++--
>>  1 file changed, 8 insertions(+), 2 deletions(-)
>> 
>> diff --git a/dim b/dim
>> index b788edd29653..79d616cbf354 100755
>> --- a/dim
>> +++ b/dim
>> @@ -513,9 +513,15 @@ function commit_rerere_cache
>>  
>>  		git pull >& /dev/null
>>  		rm $(rr_cache_dir)/rr-cache -Rf &> /dev/null || true
>> -		cp $(rr_cache_dir)/* rr-cache -r
>> +		cp $(rr_cache_dir)/* rr-cache -r --preserve=timestamps
>>  		git add ./*.patch >& /dev/null || true
>> -		git add rr-cache/* > /dev/null
>> +		for file  in $(git ls-files); do
>> +			if ! git log --since="60 days ago" --name-only -- $file | grep $file &> /dev/null; then
>> +				git rm $file &> /dev/null
>> +				echo deleting $file
>> +			fi
>> +		done
>> +		find rr-cache/ -ctime -1 -type f -print0 | xargs -0 git add > /dev/null
>>  		git rm rr-cache/rr-cache &> /dev/null || true
>>  		if git commit -m "$time: $integration_branch rerere cache update" >& /dev/null; then
>>  			echo -n "New commit. "
>> -- 
>> 2.13.2
>> 
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-07-14  9:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12 12:12 [PATCH 1/2] dim: Move all rerere updating into helpers Daniel Vetter
2017-07-12 12:12 ` [PATCH 2/2] dim: Try to gc the rr-cache Daniel Vetter
2017-07-13 20:16   ` Sean Paul
2017-07-14  9:57     ` Jani Nikula [this message]
2017-07-14 13:46       ` Daniel Vetter
2017-07-13 20:14 ` [PATCH 1/2] dim: Move all rerere updating into helpers Sean Paul

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=87379zl4sc.fsf@nikula.org \
    --to=jani.nikula@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=seanpaul@chromium.org \
    /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