From nobody Tue May 30 21:00:53 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QW4Yj2W0wz4Y97t for ; Tue, 30 May 2023 21:00:57 +0000 (UTC) (envelope-from leres@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QW4Yj243Vz4Pc5; Tue, 30 May 2023 21:00:57 +0000 (UTC) (envelope-from leres@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685480457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ky08+lE+nGJB2KF6qDUnsWi6ZPr+GUmy+54XkXGho1k=; b=qvS98zPSLC9IXRWIbAouPDk6py7SyU9bI8YOkEm/ucwLbAeHG+NF7RPbqPuOtsUJS+lCIi 1Wi9twBT84sfYvaXGiKLL5qJLTzyxXBJo/GFlFbHU6GP4JotS7HfUiJ41Xmk1Rd4LLt6lI evh3G7LsUNqME+CB1h5lK8BQHrLrcBN/4yXj5Lp7R0o8u8aywoPUr8/2oZhfVXjnXKK10a Svj4GEUNVngF2epsKIGi6+8HiDQAMhLwzSy2UOOLQqL+NYmjqtuiSM1cascoyGbHN8Ucy8 rREmTInhthw93+03o7xQo1tnwZxn69cUdkkkTrKFHH6Fu5+c7CRlt67Ua+gqWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685480457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ky08+lE+nGJB2KF6qDUnsWi6ZPr+GUmy+54XkXGho1k=; b=mT60NpcU/EK/izwUrfKaGEyTAD0UBNBYSI7/6+ulQ7wV58n5IBe6RZo0VHx5PRioWiQ1Ra zhjVMtDAL8yT9wEeO/mVEdVkM+QeAgsYiwsTfU2t9gJ90RYYJ0oA7bsixXXPVnMrH8YqNp 8BV8fMW377kJZ5nIQphbctXbX3wJYlFv5MgnZDUJ3XfOwRaI/XzBFDLrVMPJ+VhusQbLUq K6YJzfAlOCLtT1dDWaW1EHvYnJKuWljlCQcJuDV/gTTXcTz6n4yPW1gZOxYKSKnyDm8SBP Z3YSv1FzSTC+mAxp4OtRvSMKMg79bdYEgSFIxY6V8jSpNsLobVxlcZsv0PP6Iw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685480457; a=rsa-sha256; cv=none; b=tC/5bf5c2vGCPBGCbNm9j5H2u4YUjWG9rsf1InpJg1PZtXTiHPDMaGHel/DLBHEjcmxKwk HK3nwbQ340SFRqrPYir/9bHeYpzJxue/ihSNA8evBseFJHd5T0z36iGW/6QDF2+YgcGu+h 4JyG4tbdT2oojHPcfp/6bq4ee9DWped/FsuEaToyCD8XNo7CAMSXBL/ZWonsmK3RelGd3X cGydKj1qj5qgtDF1dbFfuu/be390o8SXwk7Hjx3D19CapKwJaBtL7ts1d3YQGAR1HsJg3b e36hm/CWR7w7G2/tz/Iub52Rp6Aiqtb4b5C5pjM8hY94kdg6H6iprTapoNx5Bw== Received: from [IPV6:fd:1965::2] (unknown [IPv6:2600:1700:ab1b:6800::49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: leres) by smtp.freebsd.org (Postfix) with ESMTPSA id 4QW4Yh6kJVznvZ; Tue, 30 May 2023 21:00:56 +0000 (UTC) (envelope-from leres@freebsd.org) Message-ID: <7be9b247-a521-5cde-1a47-dd595b35194c@freebsd.org> Date: Tue, 30 May 2023 14:00:53 -0700 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: ccache Content-Language: en-US From: Craig Leres To: Bakul Shah , freebsd-hackers References: <671864AD-11F0-487B-9597-ACF28D24591B@iitbombay.org> <92bc05d9-14fc-0928-4f36-4b55815303fe@freebsd.org> In-Reply-To: <92bc05d9-14fc-0928-4f36-4b55815303fe@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ThisMailContainsUnwantedMimeParts: N On 4/3/23 18:48, Craig Leres wrote: > On 4/3/23 17:09, Bakul Shah wrote: >> Am I use ccache incorrectly or is there a bug? >> >> # CCACHE_DIR=/usr/obj/ccache ccache -s >> cache directory                     /usr/obj/ccache >> primary config                      /usr/obj/ccache/ccache.conf >> secondary config      (readonly)    /usr/local/etc/ccache.conf >> stats updated                       Mon Apr  3 16:54:31 2023 >> ... >> cleanups performed                   507 >> files in cache                   2795230 >> cache size                           2.9 GB <=== >> max cache size                      15.0 GB >> # find /usr/obj/ccache -type f |wc >>   2795395 2795395 142222206 >> # du -sh /usr/obj/ccache >>   83G    /usr/obj/ccache    <=== >> >> I have >> >> WITH_CCACHE_BUILD=yes >> CCACHE_DIR=/usr/obj/ccache >> >> in /etc/make.conf > > Thank you for bringing this up; I have the same issue and have never > figured it out. But I think I've found another piece or two of the puzzle. > > Using my favorite ktrace trick we can see that by default it tries to > open /usr/local/etc/ccache.conf: > >     zinc 32 % cd /tmp && ktrace -di ccache -s > /dev/null >     zinc 33 % kdump | fgrep NAMI | fgrep ccache.conf >      17418 ccache   NAMI  "/usr/local/etc/ccache.conf" >   17418 ccache   NAMI  "/home/zinc/u0/leres/.ccache/ccache.conf" > > I suspect the trick here is when ccache runs inside a poudriere jail, > ccache.conf is not present and/or not in the right location. > > On my build server I have /var/cache/ccache/ccache.conf which I believe > works for some things but I still have 46 GB in /var/cache/ccache and > /var/cache/ccache/ccache.conf is trying to limit use to 8 GB. > > If I start up a poudriere jail and look around I find > /root/.ccache/ccache.conf is a copy of /var/cache/ccache/ccache.conf. So > I don't get why it doesn't work. > > (Now I'll sit back and wait for something who knows more chimes in...) Nobody stepped up and I haven't figured out how to make ccache obey max_size when run from inside the context of a poudriere jail but I do see now how to keep a lid on ccache disk usage. I found that if I ran "ccache -c" as root, a .ccache directory would get created in /root. I could also see an attempt to open /usr/local/etc/ccache.conf so I created this with the following: cache_dir = /var/cache/ccache max_size = 8.0G I then added a cron job to run this command at midnight: /usr/local/bin/ccache -c | fgrep -v 'Cleaned cache' As the saying goes, "crude, but effective." Craig