From: Patrick Steinhardt <ps@pks.im>
To: "Carlo Marcelo Arenas Belón" <carenas@gmail.com>
Cc: git@vger.kernel.org, pclouds@gmail.com, brad@comstyle.com,
collin.funk1@gmail.com
Subject: Re: [PATCH] builtin/gc: improve total_ram calculation for HAVE_BSD_SYSCTL
Date: Wed, 2 Jul 2025 17:23:09 +0200 [thread overview]
Message-ID: <aGVO3ej7bEo5swih@pks.im> (raw)
In-Reply-To: <20250702144244.43858-1-carenas@gmail.com>
On Wed, Jul 02, 2025 at 07:42:44AM -0700, Carlo Marcelo Arenas Belón wrote:
> In BSD systems other than macOS, since 9806f5a7bf (gc --auto:
> exclude base pack if not enough mem to "repack -ad", 2018-04-15),
> sysctl() use HW_PHYSMEM with the wrong size for the target.
>
> Use the correct type for physical_memory on each option and make
> sure it is initialized, so it is safe to use even if sysctl() fails.
We don't use it though when sysctl(3) fails, do we? We only return
`physical_memory` in case sysctl(3) returned zero, which indicates
success. Which raises the question whether that function ever returns a
zero value without writing the value to the pointer.
Not that it would really hurt to initialize the value, but I found this
explanation to be puzzling.
> While at it, add a cast to the returned value for consistency.
Okay. It's not really needed, but other branches do it, as well.
Patrick
next prev parent reply other threads:[~2025-07-02 15:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 14:42 [PATCH] builtin/gc: improve total_ram calculation for HAVE_BSD_SYSCTL Carlo Marcelo Arenas Belón
2025-07-02 15:23 ` Patrick Steinhardt [this message]
2025-07-02 17:04 ` Carlo Marcelo Arenas Belón
2025-07-02 15:46 ` [PATCH v2] builtin/gc: protect against sysctl() failure in total_ram Carlo Marcelo Arenas Belón
2025-07-02 18:42 ` Junio C Hamano
2025-07-02 20:22 ` Carlo Marcelo Arenas Belón
2025-07-02 20:59 ` Junio C Hamano
2025-07-02 20:21 ` [PATCH v3] builtin/gc: correct total_ram calculation with HAVE_BSD_SYSCTL Carlo Marcelo Arenas Belón
2025-07-02 21:14 ` Junio C Hamano
2025-07-02 22:42 ` Carlo Marcelo Arenas Belón
2025-07-02 22:59 ` Junio C Hamano
2025-07-03 8:01 ` [PATCH v4] " Carlo Marcelo Arenas Belón
2025-07-07 13:39 ` Junio C Hamano
2025-07-07 16:45 ` [PATCH v5] " Carlo Marcelo Arenas Belón
2025-07-07 17:09 ` Junio C Hamano
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=aGVO3ej7bEo5swih@pks.im \
--to=ps@pks.im \
--cc=brad@comstyle.com \
--cc=carenas@gmail.com \
--cc=collin.funk1@gmail.com \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.