From nobody Sat Dec 04 19:04:35 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 74D0818D47CB; Sat, 4 Dec 2021 19:04:38 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J5zdf0zMRz58hd; Sat, 4 Dec 2021 19:04:38 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 1B4J4ZHa009757 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 4 Dec 2021 11:04:35 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 1B4J4ZdW009756; Sat, 4 Dec 2021 11:04:35 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Sat, 4 Dec 2021 11:04:35 -0800 From: Gleb Smirnoff To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ad2a0aec2954 - main - nhop: hash ifnet pointer instead of if_index Message-ID: References: <202112041806.1B4I6HGV058876@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4J5zdf0zMRz58hd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Sat, Dec 04, 2021 at 06:16:42PM +0000, Bjoern A. Zeeb wrote: B> > commit ad2a0aec295478e750158b8985422f15deee0e54 B> > Author: Gleb Smirnoff B> > AuthorDate: 2021-12-04 18:05:46 +0000 B> > Commit: Gleb Smirnoff B> > CommitDate: 2021-12-04 18:05:46 +0000 B> > B> > nhop: hash ifnet pointer instead of if_index B> > B> > Yet another problem created by VIMAGE/if_vmove/epair design that B> > relocates ifnet between vnets and changes if_index. Since if_index B> > changes, nhop hash values also changes, unlink_nhop() isn't able to B> > find entry in hash and leaks the nhop. Since nhop references ifnet, B> > the latter is also leaked. As result running network tests leaks B> > memory on every single test that creates vnet jail. B> B> That sounds like something (new) is done in wrong sequence for these B> cases. Plastering around that sounds wrong as it simply hides the B> real problem. There is nothing new here. if_vmove() make if_index field non-immutable and that creates a list of problems. For this particular case using pointer isn't a plaster, even a microoptimisation - one less dereference. But for other problems, something different needs to be done. I have WIP that maintains two indexes - a virtualized and global one: https://github.com/glebius/FreeBSD/commits/ifindex Other approach I am considering - keep only the global one and use a function if_index(ifp) to calculate sequential number of given ifnet within its vnet, so that there are no holes. That's what userland API expects. -- Gleb Smirnoff