From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.147 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796200716; b=0IP7X6SRvkd0XMNgpsBPJ05/Qndpv5SBi5SJ/D7NP99e+dHT0cYoQUAw7G48vfjwJ/HB f+g4Lqm/+Puvfr3BHkt5naIo/fhfTG2RyVof81vTNo4dxHN/bkZaHWbqYD8hj0tW4L53N BJt81x+xMxHjIIytDgfctOlDwsDZsRT1ZH/ebMOEygYPckb4UhITrw/4DQ4l6QL5/B46H YJ2SAqChwNSq/5qGFtgGJn6V8smPjP3eStEtJ+Us+sguk2GWBKnOBtOC2WvAw3zA7aZ7E m6areAcHoXCDfD7Ne33LAhK0uF5Kfc4E9toEt69SLvzuBaoYas+QjBRSavUrGgaosPA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796200716; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Wat9JXvIHSrbmqlRIiZbbVu7LxDgcG5PLjEmoOX9aj4=; b=jqI4IAhzK62mf2+OO+rBPDcYZvGsW77u38eMUzyCUhlLszL78PJXeJWPcxRjUKdxnMth QO8hKpdZSODXKafe0RiyN17U+wHZwq4KbX7Wtb7e0hN1lwWzbVMxUALoYSj3C7rq50mlb pKOsQihOftkPAevodkD26x4MI/MFKUIuA5KVsfCvihZ2bhAOdDgW8SQC4OE6KfdYkkQnV Gom0fVaOptK4tTfT+6Uf1TKsw8jwpeG5iso+eD2OmnjnZj8Zgsv1X7HVwK4muuJzZB/+b dJog/jMF6YynS0j0udYMe9t/IApVSmGli0jK/pNcLCA9USMKz3X3C0SZcxwxcMlk6kw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b="KSvOL/wn"; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b="k5Jwi/9g"; arc=none smtp.remote-ip=103.168.172.147 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3F59606A322 for ; Wed, 2 Dec 2026 08:38:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A3F59606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=KSvOL/wn; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=k5Jwi/9g Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id D0834EC0548 for ; Wed, 2 Dec 2026 03:38:34 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Wed, 02 Dec 2026 03:38:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1796200714; x=1796287114; bh=Wat9JXvIHS rbmqlRIiZbbVu7LxDgcG5PLjEmoOX9aj4=; b=KSvOL/wnK/a5EZKCsCoTWQ8Kxf wemi7Xrh+9ds+DQMZs1N4f2mr+dAYizuebbyWLEwnuyPn95eIZJg+oEZNljEBbnk T6pZ3acoh/yDtw1khWNj5gSyqVRypgRvjDxCF2fDZe3vXWDptuhAJtrR9m757JYU 8wMtzvN8C4hFEBp77KqwD+5Uije1G2Te0IZbpu3zSw3uFAjD3e9xD85sebWQMcY1 2rjVpQrxCuiFL7FbLiQosN9kV3+r0kcOxQ/p5RLy3lptVOHaO8mSoJqbrjmiN0L5 h/9SUS9f9Sv6y9RpfNZiD1icrALg+QwdPUSkYqpe+Ub4eFCsZ4XlVdfPf4kQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1796200714; x=1796287114; bh=Wat9JXvIHSrbmqlRIiZbbVu7LxDgcG5PLjE moOX9aj4=; b=k5Jwi/9gHEsO9LQjMKosXro3Fpi+v/N1RBOU2bLHKzgCfCPhNXv +PluYxhcPfmRdZL7X1/v6l/Iy+OL2uMHmkHbx65nylNhlTrpcgjEyZ/QzFvQG5cI LWZ0EXLQvO8U+3xnzSEVTgAcsxYABDr18Z+o/++Z3RS2Ru+fzjvBWYbZjgH5y5kT 0P3jfxDXg2tT0sblUCxNA8e6ELElzW6y0kpwH0kHuIrRwHc6o+0eu/t8zVhWpYD/ QOVKP2Z4jMehAofg7jSrcC4TTbP9Tg1qkAHWG0pU16RzSwLQmgcWn/Z8vs3jgeCb Oi3p8WgfF8woC26FZe0otG73fetcEgMBqfA== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pks.im a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796200714; d=pks.im; mf=PHBzQHBrcy5pbT4=; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:sFaMj0QrnszdGcmJqdJdrzQ4ODG6HRrLaaprj09wai7K2Ao bQQkkvjjCLyMAraJUsV5r/iH37bAi0jqdY4HiWHr4Oer6wJSoF9u+eiWyaTBOTmb gdrThsDKzfFY3N0FxgMWbi4YWhkIxhRUHPf2k4Cpzc13d+3YhM08t5nSv8UGwRwm 8bYjLxosIgVGq3qt6gwT97gdP8l0pXnAh9xiGg9Lm6BFHOmdcptsPA22oGguhxUe ELDT2wOjlOKsgUoGXjvI+zXDqTe7x/fw13F/k7L/TW52SS3vLXDKEXJ6/pU1ZdLh 15u+Srey4Y0Tu86tJIczfNLMlSIsMw3jHw8i5pA==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:ERdBrY1baHoXaWWBOgGEio+gW6C/og7z4HUDSbFWMzs=:Z0B5ajLCxNs43XyIuAIw+XfhLImdEm7agh/S6ziOMDk=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGeWnMEVXzIEP4xtnjU0GavMxb8KBqih2xQHaLQzL1zbfDSgcVxFs4IcDnGnnXC07 VWQxB8/K0pj9TwMmjykcw29bRvZafWOaDAw+FxMDd4KS8aF5gPFhOQlfi2dXZBPCSYJAdE 9RZ8o983CKiPREkXlcesAmPPPlXoIsWTW/qWCJhAOrLmi+qaaYFfDN7Klns6/3rjKQBWpI DbZ4d7liTYo83vlnnnVUnpHPCn6SzC1TfmL2PkCRApg7YJYNFMnyuQ1RmFaOW6gVQcO7wH 0ubceNSQn28ZyfmEcPiUnoJfbYZErT0ri353aOOThSNwOV9hE1L2HnFrVzu/QL0H//OWK2 784SxO7j6lu1u5LMw/H7HUB/V05hjhV1jihUlPtbNr1AZoDvSSjICq/E/a9lYSrWME5eNS oVVcXB4THJO9fEskwvft7gpdxNt7GJR+pk7i2okJnLvDI1dk3ge1cTZNEkf0tuvIHN7Etp 9EjEOg+mLpvUDzuXUEIYRcByOsrlRMWp9G9f/VOrpqvj3rPAQ3gcu28Rm9VACzRD5W23Tj fNURUtMzv4U9GZKWOBFuG9xaFRg6KN8VteC9xNpFa/xxemfq+qtw91YPKx5sy6DfNTRk8q 08fq4Ok7e4NmrF9ZXn/B1LwGklJ8wHEmaAMI/u5l5UeRhUf19MvJhFsabs5g X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Dec 2026 03:38:34 -0500 (EST) Received: by mail (OpenSMTPD) with ESMTPSA id ca1770ee (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 2 Dec 2026 08:38:34 +0000 (UTC) Date: Wed, 2 Dec 2026 09:38:31 +0100 From: Patrick Steinhardt To: Toon Claes Cc: git@vger.kernel.org Subject: Re: [PATCH 5/6] packfile: maintain process-wide limits globally Message-ID: References: <20261120-pks-packfile-global-statistics-v1-0-19beb83b145f@pks.im> <20261120-pks-packfile-global-statistics-v1-5-19beb83b145f@pks.im> <877bhzsk55.fsf@dev.null.iotcl.com.invalid> X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877bhzsk55.fsf@dev.null.iotcl.com.invalid> On Thu, Nov 26, 2026 at 04:11:02PM +0100, Toon Claes wrote: > Patrick Steinhardt writes: > > > Our packfile subsystem has two limits that are supposed to apply > > globally across all open packfiles: > > > > - `pack_max_fds` is the maximum number of open file descriptors for > > packfiles. When we exceed that limit, we close least-recently-used > > packs until we're below it again. > > > > - "core.packedGitLimit" is the maximum number of packfile data that > > may be mapped into memory. When we exceed that limit, we close the > > least-recently-used windows into our packfiles. > > > > Those limits are supposed to be process-wide, so even across multiple > > repositories. But our current implementation will only consider > > packfiles from a given repository or object database, which may not even > > have any packfiles open when the logic kicks in. Furthermore, the logic > > assumes that we're using the "files" backend and thus unconditionally > > downcasts the object database's backend to it. > > > > Introduce a global list of all packfiles. This list is completely > > independent of the owning repository or object database, and it is > > agnostic of the actual object database backend that's in use. Use it to > > maintain the above two limits. > > Isn't it a list of "all **open** packfiles"? I find the variable name > `all_packfiles` a bit confusing. No, it's not. We keep packfiles in there even in the case when they have been closed already, or in the case where they haven't yet been opened. I was originally trying to indeed only keep them in there in case they are open. But that turned out a lot more messy than the current variant. > > diff --git a/packfile.c b/packfile.c > > index 077b0395a79..0d5647c74c8 100644 > > --- a/packfile.c > > +++ b/packfile.c > > @@ -195,6 +196,7 @@ static struct packed_git *packfile_new(struct repository *r, int extra) > > memset(p, 0, sizeof(*p)); > > p->pack_fd = -1; > > p->repo = r; > > + packfile_list_append(&all_packfiles, p, 1); > > return p; > > } > > > > @@ -243,17 +245,14 @@ static void scan_windows(struct packed_git *p, > > } > > } > > > > -static int unuse_one_window(struct object_database *odb) > > +static int unuse_one_window(void) > > I agree with Junio this signature is better, but now it requires people > to look at the code to understand it unuses the least-recent-used > window. Would it make sense to rename these to `unuse_one_lru_window()`, > and `close_one_lru_pack()`? Sure, can do. Patrick