From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 630581F09A5 for ; Fri, 3 Jul 2026 12:47:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783082826; cv=none; b=md/xc5eAa1YEMsKGbc5toMqbOfzEuqvMq7HaVR4F+lyI4wvY/7g4z5aZtjHORk2pB7sFS6Dm0MnM3VPQiyCstD4KHqmRQxoJRbq5q3/sqXd6Wi6qf3Jn9Gxxi8BcQs8ey4YO8fdTmuvqs2zeWzsqCr8lVDUASZ5uf88kgoFOMLM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783082826; c=relaxed/simple; bh=2jYG6Xf32+cEtSY72Mc1PL+l5rCSf2q04Wdaw1jcsok=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=H57AcCu3+Lh2gduemsskEh08WgzfttTCvGOuaLTpX1SH+GNyIWIHkCT/E/GwmkYJJ1VMbQINqe94JNehJVHCccS+UXoweWwUHN/fXNfb/iAe717ytXRSpNzZOhWYdhr/BBHw6qYSMHQSCUAD9qEA+VHlbBggrksb5rV824BqZgY= 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=elmR7j02; arc=none smtp.client-ip=209.85.214.171 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="elmR7j02" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2c9b1db4964so281705ad.0 for ; Fri, 03 Jul 2026 05:47:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783082825; x=1783687625; 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=I4FlisNClq+WLU9VmGBotriJLcRO/uQKg32SCiTN5SY=; b=elmR7j02SHeKdKM4RJKl0H65g3WiBe5szm7u2Xt/xiAcpak9FLO2xBtK2qYaFOCsol AEGz+p4RkFNz6m72AejL9gfDf7C58KQqjnrMttURvVJyHyOT0oaw5FXJBQywzy0CldvV 6C0vQ1CwyKBq1oMzuDIOPJGYEey2tiT73RgIQyetCw5XSICjaNX4raLUkWeqvsHLLcFI re2Okv6x6d0U5KLaqD+P5i9NwlxKsSq8IpY2eQ9goLmmXIbKF0fEvUiFZebM+el5EDmD Dy+UoZLOrN9udBGe2CVfRvOYwyPO6xQHtEfDp3SSIMaoxLFp9tHgtzo8ug4cYhegv+4r TRQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783082825; x=1783687625; 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=I4FlisNClq+WLU9VmGBotriJLcRO/uQKg32SCiTN5SY=; b=e/O2JEDwaSSrmgxJUzkCTqwz6mzOG7zBeQBCW9x99V49+uKKr6I/ubE4FP7mMlzU16 /EwlKScENNZP6LInIkKQpYyFGtO0fOCXV/TnkBfKUARguOjtrC/D9/uC6UKT26KqWHky dzvpIKmuXUEjRIjDdpPfOhbATzXFVWwzZgDQVEHEY8Vvj1Ot9p0YnNM35I7kenrjI+FT MNUcI/Baf4vNDQnqkGj8TWMJ/vphtLMxTGKONH3gY589uHibkOqKoMrfTW97Lwfyzi5H 0ovrO+pzHwGtQ2Qs/Jpgx+PQrBUO88i449FgrtjWC1+E16sXwaGOJVZaLwuQUPzxSjrf ZjVg== X-Forwarded-Encrypted: i=1; AHgh+Ro7/ri+ztyYbeS8XAuN9w82ehFhCFmdC4CNkyv/Vo7AAU9jzJwqNvsEJqhdKvsJy61/f8+AZP9vflt/E28=@vger.kernel.org X-Gm-Message-State: AOJu0YzqT90XKN2zKxo6/2asH4vfDxSJ2Sq6v7R54iw3iIUh48vx+WO0 J7jLMitfpILINetpHaSWpmQhfqmJ5Icu2qhTkJwHi76w/eNl0p92DNvYhfmzkq6Cow== X-Gm-Gg: AfdE7cleMlLDfn+c35qbiDlQM5GD0yuxPxFIHYvIbDNEuZJCNLdAH++AkT1bWdHT+73 oGGtpl/xRF7VtQuFp/KodoSW+dCUCPSIKrkaRL2sQK8/dCMY6b4vbp8xyGvQ94/HhxBpUm4pV+z Ps6/EAFeKWi9SU4ihhsuYpWWA+ogg4cBqHHcIXGU+vwzB0sGz/NEZjfZPvFZ1AaR17B/T8bvdLr zQMQT4ED+CsDJ1sw6rLd6NrO6qY231rWO6Xec5QxLnLeU73k70W10YobyJYPnyMorYZ7CtuM4/+ wzMh7R5xgk+MzhIAtTHshsQdLSqwRmF8DDHvPo+Pc+VbBF1xr8VfWcQiX1dm2JBeRjvlkPGqsx/ WpB22gnR1JSYpNyyzSIM9wbV77RY65p2x9tsODqIkoQiKcbeplie4goKywt7E1X+780pjZXdMTs 75pOPqnh/n5WJAE2mVQ3FHykUtyeN/4PRVMcA2E0O61uCC1L8= X-Received: by 2002:a17:902:d581:b0:2ba:73c3:49b0 with SMTP id d9443c01a7336-2caa3942d30mr5410005ad.14.1783082824027; Fri, 03 Jul 2026 05:47:04 -0700 (PDT) Received: from google.com (10.129.124.34.bc.googleusercontent.com. [34.124.129.10]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c9e8f3d74ccsm2728907a12.9.2026.07.03.05.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2026 05:47:03 -0700 (PDT) Date: Fri, 3 Jul 2026 12:46:58 +0000 From: Pranjal Shrivastava To: Christoph Hellwig Cc: Matthew Wilcox , 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 25, 2026 at 11:56:08PM -0700, Christoph Hellwig wrote: > [sorry, dropped the ball a bit on this due to overload] > > On Thu, Jun 18, 2026 at 07:20:06PM +0100, Matthew Wilcox wrote: > > 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). > > True. But also not relevant for direct I/O user pinning. If we stopped > having valid folios for anything mapped into userspace, > iov_iter_extract_bvecs would run into problems, and we had the discussion > before that at least right now it would be hard to fix. > +1. I see that extract_bvecs also rely on user memory to have valid folios even if we were to re-use parts of it (get_contig_folio_len) it still relies on page_folio() as detailed in the other reply. > Also if iov_iter_extract_bvecs was used on kvec or bvec iters we could > run into the slab problem. The block usage currently makes sure bvec > iters are not handed to iov_iter_extract_bvecs, but there is no such > thing for kvec vectors, although no one is using them for direct I/O > right now. Not that I'd want to rely on that in the long run. > Do we have use-cases for a kernel user for direct I/O ? (Just curious to know if there's something on the horizon). Thanks, Praan