Date: Wed, 24 Sep 2025 00:16:07 +0800 From: Zhenlei Huang <zlei@FreeBSD.org> To: Guido Falsi <madpilot@FreeBSD.org> Cc: "Jonathan T. Looney" <jtl@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0ec13430c583 - main - sys/netinet6: Fix ABI breakage introduced with RFC 7217 support Message-ID: <6657C773-2A9B-4C76-BAAC-E3CCE69CA5D1@FreeBSD.org> In-Reply-To: <6c318ff2-48af-4d8d-8f0f-eea629f42e62@FreeBSD.org> References: <202509220759.58M7xkrM031432@gitrepo.freebsd.org> <CADrOrmv22FzL9oP-B3NF=McMawJkQ5%2BL0zuvYSd0xRK%2BdnNYXQ@mail.gmail.com> <d6f5fe28-67a2-49c2-8ab2-fdbf9e55a4d9@FreeBSD.org> <CADrOrmu_c0wwTvxWzi2ivUmJY8qNZeMjMPEDeG3yJdYzVN3N2A@mail.gmail.com> <6c318ff2-48af-4d8d-8f0f-eea629f42e62@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Sep 23, 2025, at 11:48 PM, Guido Falsi <madpilot@FreeBSD.org> = wrote: >=20 > On 9/23/25 17:27, Jonathan T. Looney wrote: >> On Mon, Sep 22, 2025 at 11:44=E2=80=AFAM Guido Falsi = <madpilot@freebsd.org <mailto:madpilot@freebsd.org>> wrote: >> On 9/22/25 17:37, Jonathan T. Looney wrote: >> > This seems like it is probably a low-frequency event. If so, = why >> is a >> > counter a better choice for this than an atomic? >> > >> I used counters because they were already being used in the = netinet6 >> code, and are a good match for the use. >> What makes them a good match for the use? Counters are generally best = for write-often, read-rarely (by comparison) things, like statistics, = where we want to avoid contention in a often-used critical path. For = low-frequency events, the expense of keeping the counters (memory usage = multiplied by the number of cores; more difficult debugging; etc.) may = outweigh the benefits. >=20 > Maybe I explained myself poorly, I meant to say the structure already = uses counters and they work. Jonathan is not talking about the correctness but he hints it is = overkill to use a counter(9) for a rarely updated struct member. >=20 > It did not occur to me to use something different, but I see no = problem using a different tool, as long as it works and does not make = the logic more complex. An atomic(9) is sufficient, so you can eliminate alloc / free and the = code is shorter :) >=20 > --=20 > Guido Falsi <madpilot@FreeBSD.org> >=20 Best regards, Zhenlei
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6657C773-2A9B-4C76-BAAC-E3CCE69CA5D1>