mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: David CARLIER <devnexen@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Josh Law <objecting@objecting.org>,
	Dennis Zhou <dennis@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib: fix compare_delta parameter order in percpu_counter_tree
Date: Mon, 16 Mar 2026 10:23:05 -0400	[thread overview]
Message-ID: <03f765da-063c-4d3f-af46-c003025d95a2@efficios.com> (raw)
In-Reply-To: <CA+XhMqzshFWmoefhjY+3cNB=qCc0o118yb+x0FyNbgmrdyxjTw@mail.gmail.com>

On 2026-03-16 10:15, David CARLIER wrote:
> On Mon, 16 Mar 2026 at 13:53, Mathieu Desnoyers
> <mathieu.desnoyers@efficios.com> wrote:
>>
>> On 2026-03-16 09:41, David CARLIER wrote:
>>> Sure. For precise_compare_value, the boundary tests extend
>>>     naturally — the function must return the exact result regardless
>>>     of which code path (fast approximate or precise fallback) is taken.
>>>
>>>     For the two-counter APIs, I noticed that the combined accuracy
>>>     is always symmetric: over_a + under_b = under_a + over_b =
>>>     (bs_a + bs_b - 1) * multiplier, so the asymmetric gap test
>>>     doesn't apply there. But boundary tests at the combined accuracy
>>>     limit still provide useful coverage.
>>
>> In order to do a relevant test for the two-counter APIs, we'll need
>> to initialize each of the two counters with different batch sizes.
>> This will ensure that the limits are asymmetric, and therefore allow
>> more precise testing of the limit conditions.
>>
>> Thanks,
>>
>> Mathieu
> 
> I looked into this but since accuracy_multiplier is a single global
>    constant, the combined accuracy ends up symmetric regardless of
>    batch sizes. For the two-counter comparison:
> 
>      accuracy_pos = over_a + under_b
>      accuracy_neg = under_a + over_b
> 
>    Since under = batch_size * M and over = (batch_size - 1) * M,
>    both sides always simplify to the same value. So the asymmetric
>    gap test only applies to the single-value comparison APIs.
> 
>    Should I keep the two-counter test with symmetric boundary
>    coverage, or did you have something else in mind?
No, you're right, after simplification they become equivalent.

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com

      reply	other threads:[~2026-03-16 14:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 17:54 David Carlier
2026-03-14 15:30 ` Josh Law
2026-03-14 21:45 ` Andrew Morton
2026-03-15 22:00   ` Mathieu Desnoyers
2026-03-15 22:47     ` David CARLIER
2026-03-15 23:16       ` Mathieu Desnoyers
2026-03-16  0:05         ` David CARLIER
2026-03-16  0:41           ` Mathieu Desnoyers
2026-03-16  4:28             ` David CARLIER
2026-03-16 13:06               ` Mathieu Desnoyers
2026-03-16 13:41                 ` David CARLIER
2026-03-16 13:53                   ` Mathieu Desnoyers
2026-03-16 14:15                     ` David CARLIER
2026-03-16 14:15                     ` David CARLIER
2026-03-16 14:23                       ` Mathieu Desnoyers [this message]

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=03f765da-063c-4d3f-af46-c003025d95a2@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=akpm@linux-foundation.org \
    --cc=dennis@kernel.org \
    --cc=devnexen@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=objecting@objecting.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®