From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (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 39D4E3A758D for ; Tue, 10 Mar 2026 12:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773147597; cv=none; b=l1c8z7nmKUGJxVBnWWEN5dqhOCPIK9vUZ/I377PMsb5xa0Nb2sz1F7u99yL3A8DtonB44AmJIXGIW1Jp2V4PYcuap9kFWuQD8gM0W9NyxhGcSm8tkN/CvVgv9syIA4eg1TFDgO3n+9YrgfBtmKVX7TiNF53X37+MaJGDVK1G/QI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773147597; c=relaxed/simple; bh=3UGUinuS6z74FnlW/enJsl9vdYzSblWN+wh7FtvY4QA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nlzfsIaz08VqIens/X7H86C84wv24QLQDGjhdQxLwkihn+XIi4anNsvEgQxCvyX1ypZQ5n++WEKiTG7NMaoFyL1ybzuOTfp7ofPtOHpYT4m0JyCCFaAWzFaJrvfHfEy7nCo6WkRVLbIwjBPxLuIFTbiyrXSGd8g3Kpg4mbhShfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=RpDvagID; arc=none smtp.client-ip=209.85.160.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="RpDvagID" Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-50917e02532so28683881cf.3 for ; Tue, 10 Mar 2026 05:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1773147595; x=1773752395; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=IdfZ1gAzWMaWG4bFpHCyz70rMMacJ2An+it0IXdc3OE=; b=RpDvagID2grgSvjxLfp7lMOA+5FKkif/zGOEtM30qMWwzBjL0EpoSrBw6JAbYH5fiM CakFoI7aA3nHCgwQJNqjCkfRMTsuXTDaYGm2OlOrTN5995McTfGPIt3Naact7Jt860xw F27JWJo1LTYlrft65McVAWv5DDBjCkDaeINHNB1q+GuQ7Bi4acUEsBWTdnBduKR9J1nb J7O1Q6NKvyqIPeQ4qwlhDkyHd8DdCxwpKs4yu5x6YmT6wSrCcs3JujTp75zjLxnw512H 5wY/koMbK2zQzbZ05NH32DKMRKGvkyX2C+SOfI6Y6lnjSH8/O4bSB1wPXbyAuQhgzqPu 1ijA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773147595; x=1773752395; h=in-reply-to:content-disposition: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; bh=IdfZ1gAzWMaWG4bFpHCyz70rMMacJ2An+it0IXdc3OE=; b=K+BNRwYnoEs0IRaPdbeJ2eWllg7g6x2b/G4O2T5QT3RIrI4S2qEiWYUCm9ND1gAzwD 9gB79K3ujpnf8mqGZ1yhLDdfhZeHBnYWKyPhzCjakF64pkkSV/LCQT9QIDZ9yjqnlHVE ZzDLXAzROV+m8ejisJOGORYJpuJFfBr8KVTc3NAnaIwcQeOx9o92JXcAKXmgA2you1Ex EAhrAnqCqP8+f9TzHCfezYVBDyfkP0vqWNTFrnLPRNUeFhZPgHHE4iUe2Bu66kHyS+vA z7gRKUcslzSK0GJeAtgjcUwbB8U/G/vlRwVHxhe8Ts7vjiiVGTdq+g9me1idoDG+8rBe XwQg== X-Forwarded-Encrypted: i=1; AJvYcCUxZd3TPG1Qm8ZtdYuRumCA25RGkalNUrGJEFkSb4NOpYP5t9pcmCDxPmyZi6W400njInmCPwwXuV0ei7E=@vger.kernel.org X-Gm-Message-State: AOJu0Ywk3YLbeQ26Q8nsZLg+JwoKQtdixdhsqH+XF8SVbDhsHkJyltu/ DW+X3vqDHdDqUuFbyN95OUOKhZ3sxV+9KK6ANptoV6rWUdHJZu+x1rExudNP3XI5V54= X-Gm-Gg: ATEYQzxYkrCAbNq77K4G6xE8heFMyyD+sd1bmS3uq+5TaYCIgDCVs9+5eunhT8oClrt G1FvjOgBf/34gypM92siu5otIYGiK1USbjsRIZgmr++gZleCEwOTVXqX+rh9BfC3SMCpGhg324y 8bffxElKX2e2eWr5+AWo6Jicdtcsc/HxZ+LV9jKZUzUO4x6q6vWpLWsIbhSlS0dOBwMzLdqAXQi rbn7/6ZytXcOwDb8P9mY1jPdvKgre+Db+Gq7BqK8eCoNN6FVIo9jThlL36zbRhZqTkpyugtsevc WX+y/dw4+gnAGue1mnaotM9JheDn1IxoqeRaGaJ163WWavdBwOCQ4zfsm9weOKlWqnoc6beMvr7 J1rYpEx4qzLf9NoAxRFNgd1N0YgUNlQ+uV6U9/l83UWb/xmh2VwlXxkf9XL9OTvp0nO/2Q99P0j WS9tBf3FtktIQJ4TR50sD+wkv/zUFunbx5tTNRfsvyVkQVx9EyZxsM2yujf+RSZsgZrGTA8ABw9 OixMtfN X-Received: by 2002:a05:622a:1aa1:b0:509:1b34:5350 with SMTP id d75a77b69052e-5091b34579dmr86614331cf.27.1773147595190; Tue, 10 Mar 2026 05:59:55 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-112-119.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.112.119]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-508fd904d51sm77155411cf.4.2026.03.10.05.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 05:59:54 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1vzwgj-00000005Uqh-3i7S; Tue, 10 Mar 2026 09:59:53 -0300 Date: Tue, 10 Mar 2026 09:59:53 -0300 From: Jason Gunthorpe To: "Kasireddy, Vivek" Cc: Julian Orth , Andrew Morton , "Deak, Imre" , Sakari Ailus , Thomas Hellstrom , "linux-kernel@vger.kernel.org" , Gerd Hoffmann , Sumit Semwal , Christian =?utf-8?B?S8O2bmln?= , "dri-devel@lists.freedesktop.org" , "linux-media@vger.kernel.org" , "linaro-mm-sig@lists.linaro.org" Subject: Re: [PATCH] lib/scatterlist: fix sg_page_count and sg_dma_page_count Message-ID: <20260310125953.GS1687929@ziepe.ca> References: <20260308-scatterlist-v1-1-39c4566b0bba@gmail.com> <20260308180826.GG1687929@ziepe.ca> 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 Tue, Mar 10, 2026 at 05:49:23AM +0000, Kasireddy, Vivek wrote: > There are a couple of reasons why we got rid of the pages array: > - Back then, there was some confusion about whether a struct page would > exist or not for tail pages when HVO is enabled. Regardless, there was also > a concern about exposing tail pages outside hugetlb code. The existing code relies on struct page for the vmap: for (pg = 0; pg < ubuf->pagecount; pg++) pages[pg] = folio_page(ubuf->folios[pg], ubuf->offsets[pg] >> PAGE_SHIFT); Tail pages always exist, they are required by many interfaces. > - And, we also wanted to prepare for a future where struct page would not > exist anymore, so, it made sense to just use folios only. If you can 100% stick with whole folios then great, but we don't have the APIs for that cases udmabuf needs right now. Most likely we'd expect to use phys_addr_t for scatterlist and direct full folio for vmap. Neither is helped by the datastructure in udmabuf. Jason