From nobody Tue May 30 21:48:03 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 4QW5cK42YHz4YDMn for ; Tue, 30 May 2023 21:48:17 +0000 (UTC) (envelope-from bakul@iitbombay.org) Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QW5cJ39Fnz3Fc4 for ; Tue, 30 May 2023 21:48:16 +0000 (UTC) (envelope-from bakul@iitbombay.org) Authentication-Results: mx1.freebsd.org; none Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-64d2da69fdfso5773600b3a.0 for ; Tue, 30 May 2023 14:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iitbombay-org.20221208.gappssmtp.com; s=20221208; t=1685483295; x=1688075295; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CDcpMYFkhGNYYvtDzg0cXqhZPvRxl5EfVijgHtRhsbQ=; b=vKxsd6X7LcHsJxbUxdwcFLFv9J/j+8mxbeSC7HNFNV3km2o/VdFA8i5o55jFlBawPT PHOjD8Xv7KcFDAVWQPhy0q3yphs98jTI7xMjLwoEp7cV829JOy5CUVFeEs+EA6O31Qxc c2LhjIo69RFrovx6Qj2anMwyT4RSrghfk0PiAzwz8pdZXLsbTLZzqrokp7s3qMszjwSe 1Inrb0tvuqRxBRtJhMzhx6zgJ1t+WWKC5IKS/9NrVdjdnPJPejMfNBROqADvOMaVWvUz DZrX8NB2v8hpBovhUEWd3NRRIbFDOWKYvCuM2Mxs2wqR+DXsXYdpal6RqD0ILVcBF/T6 KJZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685483295; x=1688075295; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CDcpMYFkhGNYYvtDzg0cXqhZPvRxl5EfVijgHtRhsbQ=; b=eMRGLikXlpiLu9Tshpr6UuDf7o7KK3VaEV6GK519a5hUok9n1fdRUp16rDH/4ed6vQ DCIwfFM52FbMnNwCT9hKh+UGOS6CF2ya6N8cARgDu9PIyN0Y9VuH7FTgKZCa2RIc20x1 F2xQHW/t7K7vMaDBOPE8Qgt8AjwdKsae0fXNTA80qg10khjma6v+Q2ZoTuY9iG0TLPFl lgV35IRinOM+n7FB7sBTeNDF9kEypY8pD8h5mI1txfBjggZNS/5OEQfaAqGCTy0esjwS vVoK6lNFHYR+l/84cRjCUG50GrfGpuWWFlV6LA8hzjeFpnbJD8Tuit+Q2z/peUkJw9HA snRg== X-Gm-Message-State: AC+VfDzAoq37FOANm7GE90N99dmvbaClNLDa1bpTGWCV025Nu46tlDnS bwiP86gekx9KPeAQf/6+7L4g6QMoVxuwiGZUWEA= X-Google-Smtp-Source: ACHHUZ4lR7qXz6EfXcHeHwmp/Aw3/zEAOt3+okyz4zCldn9hRpK+LCd7C31ix2R0t/6Z2S4nrBMooA== X-Received: by 2002:a05:6a20:258b:b0:10e:ed51:a552 with SMTP id k11-20020a056a20258b00b0010eed51a552mr4022339pzd.59.1685483294977; Tue, 30 May 2023 14:48:14 -0700 (PDT) Received: from smtpclient.apple (107-215-223-229.lightspeed.sntcca.sbcglobal.net. [107.215.223.229]) by smtp.gmail.com with ESMTPSA id g20-20020a17090a7d1400b0024e37e0a67dsm9418578pjl.20.2023.05.30.14.48.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 May 2023 14:48:14 -0700 (PDT) Content-Type: text/plain; charset=us-ascii 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 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: ccache From: Bakul Shah In-Reply-To: <7be9b247-a521-5cde-1a47-dd595b35194c@freebsd.org> Date: Tue, 30 May 2023 14:48:03 -0700 Cc: freebsd-hackers Content-Transfer-Encoding: quoted-printable Message-Id: <1D896798-6BAF-4800-96C8-2ABE1603ABF4@iitbombay.org> References: <671864AD-11F0-487B-9597-ACF28D24591B@iitbombay.org> <92bc05d9-14fc-0928-4f36-4b55815303fe@freebsd.org> <7be9b247-a521-5cde-1a47-dd595b35194c@freebsd.org> To: Craig Leres X-Mailer: Apple Mail (2.3731.600.7) X-Rspamd-Queue-Id: 4QW5cJ39Fnz3Fc4 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On May 30, 2023, at 2:00 PM, Craig Leres wrote: >=20 > 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? >>>=20 >>> # CCACHE_DIR=3D/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 <=3D=3D=3D >>> 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 <=3D=3D=3D >>>=20 >>> I have >>>=20 >>> WITH_CCACHE_BUILD=3Dyes >>> CCACHE_DIR=3D/usr/obj/ccache >>>=20 >>> 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...) >=20 > 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. >=20 > 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: >=20 > cache_dir =3D /var/cache/ccache > max_size =3D 8.0G >=20 > I then added a cron job to run this command at midnight: >=20 > /usr/local/bin/ccache -c | fgrep -v 'Cleaned cache' >=20 > As the saying goes, "crude, but effective." >=20 I have been using CCACHE_DIR=3D/usr/obj/ccache ccache -c with /usr/obj/ccache/ccache.conf containing max_size =3D 15.0G Not sure what is a good size.=