From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98A782066F7 for ; Sun, 26 Oct 2025 15:06:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761491219; cv=none; b=U2Df7cUAYVkytzXx/h8VThAP6seu+wQy9OYSjtGkVfAjNF+jOsAPLftOa6B0HFjLA7hBbKEzhhvUDx/pfT4odpxD2uLK8K48p78XlBNUM5tik1+rrnv7vo9C76ewnnGjNEQ8UrZZ5Ov6JunS8NlDfz+BYiOVQhgVxPicsrW8Byw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761491219; c=relaxed/simple; bh=5GGMRkSI4d8+tD4TA6r4LveMpYENo9Im+iO54sNr+iw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Z7lcW6drzjrjx3EnxVd8o1J2dfzJP5FwaqepWoOEtX+taxppf9kbnxDTFw9nPZSil9hLhgQegJhFv8SiAG3Ul6vww4Q5DMgDBwb+a+3IiKNJ/hAz++ZSJyuEyZYP/Idvt5bhUDGelxN6FZv/8wA34KljNC2KsvDRcjDwSFUlJBs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk; spf=none smtp.mailfrom=davidwei.uk; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b=rQevN++t; arc=none smtp.client-ip=209.85.216.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=davidwei.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="rQevN++t" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-33bb1701ca5so3478711a91.3 for ; Sun, 26 Oct 2025 08:06:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1761491217; x=1762096017; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Bejr6fb3023EKDlNvUJHi45ybr5AGE7VVK5YDyAbObE=; b=rQevN++twTVK1p4Y/L330Ovy8L1HuDVekPXADMruRyuplStEsl0lR2no555DdYorVY cP+a4UnAP6TBokx24yZ7mnn9v5EUFYO43Nh140ZUpUaVwQU+dciuWfX9L/7TI0W21Ue4 7n2GlOLt/WIMre5ytZvLbgdIUN7kIPx8o5RUW0SVaLcbKyMvnVMsO2LpxKQzv41bGbwl dfF/tPfUkU5Mn3nEvKXqQWOCt5B9XLhESKLqKv7zDHM0stlg9SlCzDW3Y0eCj853ADH0 7b8SUjs8nUFmSPaBA9SG35nUGHHXx2wI1VmVxfoWLHtR6G47yX1gIax/IIzNoQV9JV8A iZSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761491217; x=1762096017; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Bejr6fb3023EKDlNvUJHi45ybr5AGE7VVK5YDyAbObE=; b=NDwGc0eGz8TXL/4APa+Qb/dtVTGWIbJeBSS3+TdElT9YWBjmLSHq8yvgYXuOryLbyk NKfCPpW9m44tTgd7aqjWxWf+fR4uNEUdCgzZH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received: by 2002:a17:90b:1d88:b0:32b:df0e:9283 with SMTP id 98e67ed59e1d1-33bcf90e86cmr44489521a91.34.1761491216967; Sun, 26 Oct 2025 08:06:56 -0700 (PDT) Received: from [192.168.86.109] ([136.27.45.11]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-33fed8178d5sm5502198a91.18.2025.10.26.08.06.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Oct 2025 08:06:56 -0700 (PDT) Message-ID: Date: Sun, 26 Oct 2025 08:06:55 -0700 Precedence: bulk X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/5] io_uring/zcrx: share an ifq between rings To: Jens Axboe , io-uring@vger.kernel.org, netdev@vger.kernel.org Cc: Pavel Begunkov References: <20251025191504.3024224-1-dw@davidwei.uk> <20251025191504.3024224-4-dw@davidwei.uk> <3a7a2318-09fb-41d2-9ba1-9d60c7e417a6@kernel.dk> Content-Language: en-US From: David Wei In-Reply-To: <3a7a2318-09fb-41d2-9ba1-9d60c7e417a6@kernel.dk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2025-10-26 06:16, Jens Axboe wrote: > On 10/25/25 10:12 PM, David Wei wrote: >> Sorry I missed this during the splitting. Will include in v3. >> >>> >>>> + ifq->proxy = src_ifq; >>> >>> For this, since the ifq is shared and reference counted, why don't they >>> just point at the same memory here? Would avoid having this ->proxy >>> thing and just skipping to that in other spots where the actual >>> io_zcrx_ifq is required? >>> >> >> I wanted a way to separate src and dst rings, while also decrementing >> refcounts once and only once. I used separate ifq objects to do this, >> but having learnt about xarray marks, I think I can use that instead. > > I'm confused, why do you even need that? You already have > ifq->proxy which is just a "link" to the shared queue, why aren't both > rings just using the same ifq structure? You already increment the > refcount when you add proxy, why can't the new ring just store the same > ifq? > The main reason is I want only-once semantics for decrementing the refcounts. I used a separate ifq to do this, marking it with -1 afterwards, but I learnt about xarray marks which lets me do the same thing. Hopefully v3 will make it clearer what I mean. It's looking really clean.