From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 861A52BE621 for ; Tue, 18 Aug 2026 23:22:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787095335; cv=none; b=X58q2mEN/B8QtJyETZlTVICvulrNudwXgCqonV9dV55Kr7sQLCjbC4zwUjYwH4ajfzH4os+kEri7LAet8Ls4kZQjbtdhGAQAHAwZbIRu0kj971WGGF2FBr7xX2tQI7Ba31jnBgWKrxNqdXQwzwjIRsBoya+HNdMpcE65fyIEOTQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787095335; c=relaxed/simple; bh=e1WByzyJHjoTRjqdDZ5trr2DzkSWuSNiweUaCCjB3J0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Nw4+6lpHCMDaJP/hJIapTaXY+eUxOLo7XMsPh9p06nMQEmSw7g993mGbMciYNhHtXiwWSKHhZFEtgAooLS2fSAi8r56u6ehJlWc3Zm038vIO3V5JRxnnWoN9za6ixJtUzRLmKyqnaXmL28Il3d+rvD6XxwqXJimY5QxtYVhtop0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=truenas.com; spf=pass smtp.mailfrom=truenas.com; dkim=pass (2048-bit key) header.d=truenas.com header.i=@truenas.com header.b=lVFBQk8r; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=truenas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=truenas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=truenas.com header.i=@truenas.com header.b="lVFBQk8r" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-49557167508so4090385e9.1 for ; Tue, 18 Aug 2026 16:22:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=truenas.com; s=google; t=1787095332; x=1787700132; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=3s+ro1L4dqcmEMXAFkp78d4td1TXtxW4mVR0/hBAGO4=; b=lVFBQk8rQ7fYAYZhYMAJvHazOeOjIEOrYJ8Jee6SYZUyz1kbZ4gYxXjc33NcUaQzPQ 24+2eypZF9uC0SoQu7ISK9nYBtITZ7nCitW8CczEnKXHnrR7Evoxg816AA8xIlQAtren ODXCrzwTjJMlP7jDFSQJne4fKBbmkrYDq211dgAI4JcHELOi7dKs+YWAi+pDjqNfqsyv udHLngbVrB7i5sPOtutQ0CTWlPGxjX+HG+GDy2sX7DOd8n5xyJEY9/OWyNrxqjvzIW0J e0HwbUaLgtUP06DarkAbsfLv1srHLR8M+JuVuvEXzyGbvLW54zgDzdvmtsRxPEGP0oRS yAsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787095332; x=1787700132; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=3s+ro1L4dqcmEMXAFkp78d4td1TXtxW4mVR0/hBAGO4=; b=q7bRBKE74w4GCyAceEb6CYsSlBe8JKubOjmCrkyB2e+kwFaV9px2MakYvzmKKsK6W+ HtcqSPbXxwDL938TDpvvFUqvu+yX2xI/hFrJ3woSu0SYkWqp2wuK1Cy3+1LMRlz9O5MU voMZKdeP++pLCZewKSnOamjWDdpkpnQ5v6fcvz9DEF54VfXBkA/AnMC36fADkxm22aa1 VTOHL09LnHf7Ypw0W01cNEG+pHCiVVtYSiJHz5uQojJneBuY6nCZjih4h8OlocStOIGL MRJTv1JdufLeMMNmVgZbKYwqR/F8Ueu3d//anjwn59JyAspoMzBrONQG9+E0P5muJgFn tiCA== X-Forwarded-Encrypted: i=1; AHgh+RpSUCz51W4AyCN4JK1seTabH2IX1hQE7YgE9quNTaPedZTfsq0UaxOZ32gfI4ybt6eztPThAWrtWyg9QIY=@vger.kernel.org X-Gm-Message-State: AOJu0YwZClijGt1UOSb9vJaLfznkZpdRoC5cqOLLkio4wIIOlOjIQBeH f+CoKop2A/zXnski5ac71oOirzawLBuWOgdZcibN59w9X3V9CxkCX41XdY/hDH7vtA== X-Gm-Gg: AR+sD10+vC7/dK+Sb6laSpZaLZRwVuvd9GxYg5eFjMDqtrZ5ivZef872rgb9Y+TX7gv iK+0Dy7lf3J4Zl5DQb9gdmAYYFZbSQkzQwWy/KHGaSI1A2opd6T+r9TGa6xC0WJ9ceijDK8cRif qh9QTsSbQx/tJBpnQ0YWBpMpY3Z0BBM73NIovKuQHikt8Eceyf2HGNHRbGV8KJwJhn4UaCZxB0R khOZOkvha20XJXD78rjag6gDHxsdp0Tkj/hEaoez/lRjJ0A9hOD+t5Xq5QLb4VaLguEaw+ZoerC JI/BNSraGfVMm8JbH5FRRCMYBPDxyTMDYKPGAsUdziepO1JmGE9c0HvIFybwHLbgnn35kKJyzB4 T6Ce/dQEF3SKNSP/lDZqjW1kHbnyCS1orcecY2Px5Do3tgCU6OHFI0ookMKPDHCymskXL8joxRk ZGOrbMJuB4fCRr1oMLVYrKtk9VkV3jha9VC1Qcme3u X-Received: by 2002:a05:600c:4f52:b0:499:7a15:fcec with SMTP id 5b1f17b1804b1-499aa1fdfb3mr6449865e9.13.1787095331739; Tue, 18 Aug 2026 16:22:11 -0700 (PDT) Received: from hamza-PC ([2400:adc1:158:c700::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482b144173csm722684f8f.6.2026.08.18.16.22.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2026 16:22:11 -0700 (PDT) Date: Wed, 19 Aug 2026 04:22:06 +0500 From: Ameer Hamza To: NeilBrown Cc: cel@kernel.org, jlayton@kernel.org, okorniev@redhat.com, Dai.Ngo@oracle.com, tom@talpey.com, trondmy@kernel.org, anna@kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, alexander.motin@truenas.com, caleb.stjohn@truenas.com Subject: Re: [PATCH 1/2] NFSD: Use nfsd_iter_read() when ->splice_read is not zero-copy Message-ID: References: <20260817210811.3984663-1-ameer.hamza@truenas.com> <20260817210811.3984663-2-ameer.hamza@truenas.com> <178709365192.2852630.5607658976022815566@noble.neil.brown.name> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <178709365192.2852630.5607658976022815566@noble.neil.brown.name> On Wed, Aug 19, 2026 at 08:54:11AM +1000, NeilBrown wrote: > On Tue, 18 Aug 2026, Ameer Hamza wrote: > > For some files splicing a READ cannot avoid a copy: gfs2, kernfs > > and the cifs direct-I/O modes use copy_splice_read() as their > > ->splice_read, and the VFS substitutes it for DAX files. > > copy_splice_read() allocates a fresh page for every page of > > payload and reads into it; nfsd_splice_actor() then installs > > those pages in rq_respages, displacing Reply pages the thread > > already owns. Both sets of pages are then freed. > > > > Route these READs through nfsd_iter_read() instead. It performs > > the same single copy, but into the thread's own Reply pages, so > > the per-READ allocation and the displacement both disappear. On > > its own this is not expected to raise throughput; it changes > > which pages a Reply is built from so that the next patch can > > recycle them. > > > > 9p and ceph fall back to copy_splice_read() only inside their > > own ->splice_read methods, which nfsd_splice_read_is_zero_copy() > > cannot detect, > > I think that if we are going to do this then we should do it properly > and make it easy to detect these cases. > > Could we add an FMODE flags FMODE_DONT_COPY_FOR_SPLICE which causes > copy_splice_read() to return -ENOTSUP or similar. > Then nfsd can call splice_read if it appear to exist, but set that flag. > If it fails with -ENOTSUP, fall back to iter_read. > > I really don't like the approach of explicitly testing whether > f_op->splice_read is a particular value. Thanks, this indeed works better. I believe it also covers 9p and ceph falling back to copy_splice_read() internally, which the helper could not see. I will work it out this way for v2.