Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Oct 2022 00:34:53 +0200
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        Kristof Provost <kp@freebsd.org>, src-committers@freebsd.org,  dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 133935d26f20 - main - pf: atomically increment state ids
Message-ID:  <CAGudoHFoAOXNo5REmkAnhipTWZ3Uf2TofW4QTmOG%2BXgKDyA4tQ@mail.gmail.com>
In-Reply-To: <Y0H4/IQ3STFvnm6m@FreeBSD.org>
References:  <202210081641.298GfT2F036984@gitrepo.freebsd.org> <Y0H4/IQ3STFvnm6m@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/9/22, Gleb Smirnoff <glebius@freebsd.org> wrote:
> On Sat, Oct 08, 2022 at 04:41:29PM +0000, Kristof Provost wrote:
> K> commit 133935d26f20c0b9c433da9a2b32bcbe562bc2c5
> K> Author:     Kristof Provost <kp@FreeBSD.org>
> K> AuthorDate: 2022-10-07 17:17:06 +0000
> K> Commit:     Kristof Provost <kp@FreeBSD.org>
> K> CommitDate: 2022-10-08 16:27:29 +0000
> K>
> K>     pf: atomically increment state ids
> K>
> K>     Rather than using a per-cpu state counter, and adding in the CPU id
> we
> K>     can atomically increment the number.
> K>     This has the advantage of removing the assumption that the CPU ID
> fits
> K>     in 8 bits.
> K>
> K>     Event:          Aberdeen Hackathon 2022
> K>     Reviewed by:    mjg
> K>     Differential Revision:  https://reviews.freebsd.org/D36915
>
> This adds an atomic operation on a single word on a state creation :(

True, but patching unr64 to be fully scalable is not hard and I intend
to do it later. The point from my end was to not add anything
handrolled.

> Previously two state creations could run in parallel without negatively
> affecting each other.
>

That's only partially true. For one, the hash tables used (and
associated locking) are not properly aligned to avoid false-sharing.
But even if they were, you still have a lot of hashing conflicts and
associated ping-pong from locking on lookup. And so on. I do have WIP
work introduce lockless lookup here though, but there is technical
debt to clean up.

-- 
Mateusz Guzik <mjguzik gmail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHFoAOXNo5REmkAnhipTWZ3Uf2TofW4QTmOG%2BXgKDyA4tQ>