From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 ECFD530DD11 for ; Fri, 19 Jun 2026 12:32:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781872334; cv=none; b=iyZPGO0cd4BDDk+QfOlCmW50MxbVI3oasJ6Nu1Q45tj9r6JKE40pMqVAnupbUNxHvM0IRMCVUp/NlicA7FitJzlkos4TWO2oObuPfP4CiyJa4i1JxdOxAHzkP6CKyHZ81wypVwiYZOvqZFH/KCYKT4kHAGQeCLVL+UvOEduaxcw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781872334; c=relaxed/simple; bh=j7paI+dBkaIDU/IeX574vRzwUw7u87K/qklOPHPQ9xY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ofqoU7AahN0eiq6IfElOc08S09TDuTPEERmHm6PTd1JBzQ86Tx5DdP8w2O8xtY5oH0XLaiIwOcJi66D3PWcvSoeIHZgLdgsejA2D5is2mv2iP6BabcWJ44KOv1kCwWEVFCHUZ05litfgCMwcDM6B16s87wY/hsEVRuAgwMXb7k8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=a+TsZ8cP; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="a+TsZ8cP" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2c6a4eccab1so37925ad.1 for ; Fri, 19 Jun 2026 05:32:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781872331; x=1782477131; 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=zAgRJPG/x/HKYBdMFy6t9gS0SW7lI2ALodBm8Z0F2FM=; b=a+TsZ8cPo9DlfKpk1KZbrFHdabGUKtN/sYEFbYnjwMHxj0nEUq/L1FxhMf9eOv0s0x GtdoOyJ5Cqjn4gA56d2jFnmlGT09bzJQY2QEOSc06SUwWQH5SVz7yGotsWAn7PiAKj9o JmaVXG3nqW0dp1BFYEuad84MtD+md8KtGJ0OzQk8fqJMFyIbD97Eh/uk0zV4Tqn1Rrhs zg3/yz385ljiS0Q6JtgzQ4qHvvldv29B1EfXS1wvwt2vXHQ2sLGB9KXsKkz3f1KKDNzO g9mzBLILFGwNv+BhB6whmqNyOknYVnZOwRym0ORt/iz23ekVyGbaLobkNSNU6fWrPeOI dc4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781872331; x=1782477131; 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=zAgRJPG/x/HKYBdMFy6t9gS0SW7lI2ALodBm8Z0F2FM=; b=CRUfybQ9XgWN6QInkz5llLmxkAp8N+pcd1OgWqEB+Y8pg/gFvoSHxYmcCV+KSVeXEi nZq917QqwvXRXlTRlUVRwKq+rpM6zFgF41gTnn5dY1f+6r/ENECxOW7cRVqvTvXcL6Xy 3cWoDFppxWZZf2RX9bdIR9eXFwcGJMF3bGssmLhtrFfYM6zokuOsDz+68QnN41LxtKMz r23BD7EVH7j5WHBTQ+dNgRxHeerFk5vnNMwA6ZiQRuZ5JnhN/UQZuG+GOh0WB8DQvlJH PKh/oUYgX77i41SoJdCnCv4w0WIS0oNFcRWb4e6idPvXdBRyZ8Mie/HPqHUZ0hrE8OH1 t7vw== X-Forwarded-Encrypted: i=1; AFNElJ9C9M2t/4lf+Gy3Yrdif6qab5KHOQ+06QKCADWaMzHBM48fgIw54Z/zhngh0RTDDAhqEdfxMG/RaGAqzwI=@vger.kernel.org X-Gm-Message-State: AOJu0YzX8qdYMNoeXgFPKyfMlLr/ixPq4sNv6fsxtes189w3tGE/3nX2 q5zt+5zEqJV5KL5mVXWAkNprFXgzdWx6IWMgj986nLHZfV2utk6EVz1bj4Cdn1XPtg== X-Gm-Gg: AfdE7ckMJ/2pqs5gImG3v5ZmU5IyYaO2pqQIqviJE1Ydl27hiy0smqWS4WZBoOKBWwy fXXmSnaGKfYM2DtD2gbuvJ+4n/arEyJoVrqBceWIyYCyD14/6wXNYgX3DKU4vs4lxDabeA0Vmp8 N1py1tnZZFvDqvq0CTzbeZ/0ruTQP1NI+4eR5e6lrPCaZtD4t1f3mH+e96R48W9wQ0gmREmbL7j SYCplUwW84m/8Tt0l7S4UWDbjXu0v4pjzX1hxrXR3bDZb9ESkHywZ7KzSNv2Ezl2WkpUAiPsc7N 5JIg8VqZcXLrLrjAD7/Pa3N7VjITi87gUgd6y0tZRzpp7BGTm2WsEosteXBRWyc7tT/+OoOSgXW UxKPkdysz/yhEqXuhY6DvhBFOvK6+ljE3pIuQ/yDvwmrlAluBdMbrxa9FXELXxH8ImEaRWu5Eg/ i4KsaMc2tCm1/1D0ad7QMh+I/EWLHaWVjpC6Co5szZRqh1ZrsQHw== X-Received: by 2002:a17:903:1a45:b0:2bd:3bfd:74f1 with SMTP id d9443c01a7336-2c718f8d692mr1926525ad.2.1781872330656; Fri, 19 Jun 2026 05:32:10 -0700 (PDT) Received: from google.com (199.255.142.34.bc.googleusercontent.com. [34.142.255.199]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-845534d42b0sm2382315b3a.0.2026.06.19.05.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 05:32:10 -0700 (PDT) Date: Fri, 19 Jun 2026 12:32:04 +0000 From: Pranjal Shrivastava To: Matthew Wilcox Cc: Christoph Hellwig , Trond Myklebust , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Anna Schumaker , Shivaji Kant , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2 6/7] nfs: Optimize direct I/O to use folios for requests Message-ID: References: <20260616134000.2733403-1-praan@google.com> <20260616134000.2733403-7-praan@google.com> <7ee3bcfdd6126c93cbb1c219bf601182b95c10d9.camel@kernel.org> 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: On Thu, Jun 18, 2026 at 07:20:06PM +0100, Matthew Wilcox wrote: Hi Matthew, Christoph, Trond, > On Thu, Jun 18, 2026 at 07:10:45AM -0700, Christoph Hellwig wrote: > > On Tue, Jun 16, 2026 at 05:23:48PM +0000, Pranjal Shrivastava wrote: > > > AFAIU, the MM subsystem explicitly ensures that every valid struct page > > > is part of a folio. > > > > It is definitively not what the vision for the folio is, although if > > I'm not mistaken it actually is still true right now. > > It's not true, eg, for slab. While there's still a struct page there > for slab, there's no refcount and flags like PG_locked have different > meanings. You'll get into a lot of trouble trying to treat slabs as > folios (and that will include assertions tripping). > > > This whole > > area is a minefield unfortunately, and we also ran into it with > > iov_iter_extract_bvecs and the earlier block code it was extracted > > from. Adding the relevant people and lists, but for now your best > > bet is to stick to what the block code does or even better reuse > > as much as possible of that code. > > Yes. Fundamentally, it is no business of the filesystem what the iov_iter > refers to. We can do direct io to slab memory, vmalloc memory, memory > that doesn't have a struct page (eg iomem), or whatever we choose. > Thanks for the clarification. I understand the larger vision of keeping filesystems agnostic to the underlying memory represented by the iov_iter The documentation for page_folio() [1] mentions that "Every page is part of a folio," but it appears there are important nuances regarding slab and other memory types that I was not aware of. However, I am a bit confused on one point: Looking at iov_iter_extract_bvecs() [1] it relies on get_contig_folio_len() [2], which calls page_folio() on the pages extracted (via iov_iter_extract_pages()) without additional checks for slab or vmalloc memory. I am happy to refactor the NFS Direct I/O path to reuse the same helper (get_contig_folio_len()) from the bvec extractor, but I'm a little confused as the bvec extractor seems to suffer from the same risk? Is the recommendation to keep these details abstracted by the iov_iter lib and eventually hide things like iov_iter_extract_pages() and manual folio conversions from filesystems entirely? If that's the case, would it help to export get_contig_folio_len() (or introduce new helpers) in the iov_iter lib for NFS and other fs to use? Thanks, Praan [1] https://elixir.bootlin.com/linux/v7.1-rc6/source/include/linux/page-flags.h#L291 [2] https://elixir.bootlin.com/linux/v7.1/source/lib/iov_iter.c#L1849