From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEEE03385BC for ; Fri, 9 Jan 2026 16:31:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767976292; cv=none; b=T/J0XMRQtKKcnuxcettj0VER0mvZbRpTBRMUUt4nDmBCnGz0fO9sv/AplQu7UWYr1siOvOa/Rij7T9VyPSkDv5xhoJF1iWpfDQozjwv4TJ/Eeor3oX5cxqR4+bAc5w92yGHQtwe1taBrKpWl2KM34MbN5bTePB+vy+rv3OMJ4nQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767976292; c=relaxed/simple; bh=sfLQbq5PkJLzZsulbRARyE0eoV1AzANKpvLzQK+dvHw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QlR5MruytwEU3/5n8BPkqSpSR32hnlReK0nHacVgLyVlbkU2AjbZT1vtLSoZt7zpSe3DA6XOzlbQ2WBpZqLNNMWxfEJrZaODLrQi2/aUorE7u60GIJCJk/vbriDJMH0H5uI8FyZoe12/UOzyXN3sonUgek2KFuB7dQb+dx9lKew= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oN3WH5Wj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oN3WH5Wj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30C46C4CEF1; Fri, 9 Jan 2026 16:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767976291; bh=sfLQbq5PkJLzZsulbRARyE0eoV1AzANKpvLzQK+dvHw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oN3WH5WjSayl7g88OEmJzUcO0PIpL71MIM5DQVXgqSa7sKG26oHHpG0okAegMaLMo Km5DGFYJpeiikOx9uwlhoOIo2qWY7psMGO/D549CaPZv/HtQKiiqVWxeX73i1WfHbq RZs3A8kicwpOlIWhHeB0JdfhM190uHKsHEPGo2ZGXKIHsDajK2BoRXxlvNJ2BNzlT8 cx8UD/OXcGjEsaTgGRKwhrqmCfCfTVUXCi/p2F5XStPxsqgauR6VZf9a+3zXDCI/nV MIzNixeDwy5E4dE0gqEiPPQE2qj8PUDYLEXg72Nmg+q0WU1Erg8iuw3G0R6ssOEsnN wjTUSuloO/NwQ== Date: Fri, 9 Jan 2026 08:31:30 -0800 From: Jakub Kicinski To: "Russell King (Oracle)" Cc: Heiner Kallweit , Andrew Lunn , Andrew Lunn , Paolo Abeni , Eric Dumazet , David Miller , "netdev@vger.kernel.org" Subject: Re: [PATCH net-next] net: phy: fixed_phy: replace list of fixed PHYs with static array Message-ID: <20260109083130.50ae4ba9@kernel.org> In-Reply-To: References: <20260108181102.4553d618@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 9 Jan 2026 15:10:18 +0000 Russell King (Oracle) wrote: > > Isn't IDA an overkill for a range this tiny? > > IDA is useful if the ID range is large and may be sparse. > > Here a bitmap would suffice. > > > > DECLARE_BITMAP(phy_fixed_ids, NUM_FP); > > > > id = find_first_zero_bit(phy_fixed_ids, NUM_FP); > > if (id >= NUM_FP) > > return -ENOSPC; > > > > set_bit(id, phy_fixed_ids); > > Racy without locking. True, if there's no existing locking wrap it in a do {} while and use test_and_set_bit() as the condition for repeat.