From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (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 BD8972561AA for ; Fri, 30 Jan 2026 15:16:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769786203; cv=none; b=dRZEm4NNd67yPiaDCvflhMKpbC1eL/QuilSXw3nKWn3dZdTKSPJf2vFMd2LV1FRpEwJlrB/2g2/Sk0Um9lgq+MPizE3JfUWFYUQeP6KdNCE/3q7EV+xlB1l7tQP5LUDOwDbhRzyr8ljJ/Dv6T1knyK1EdGIyz2e7HxWaA/aHG5g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769786203; c=relaxed/simple; bh=WmHtBHSTYxbfJ263YgNe7PXPFBdQFrEByiiVtkOz+uw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DFDPXLxgoVf4knPfdC2bHGDfHkKyi4ueNjKspyCXUbwPc/cA+otnJg8dEryMfmO0wo5YTvKY9CgBo+InSfKZJ7avk9895qiAtOvZs6j0Qy/7Uo6oY24v7tSrUn3hH+MvLYjAPvGFfq75Rqin4nujeBBH5HnBPtGhuRXMqYSebYA= 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=o3p/t+Oz; arc=none smtp.client-ip=209.85.219.41 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="o3p/t+Oz" Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-888bd3bd639so29530406d6.1 for ; Fri, 30 Jan 2026 07:16:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1769786199; x=1770390999; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=9si664lpAABtSRH5NCDTNiWW5Zo1E2FOdd2kZn8cRsw=; b=o3p/t+OzNolmstthDKxfQ2xaDr4SG5Cd5MhbMtCpLSmb1pSCcPW8jaVlip9X438OsU pvqcK+zIuEQTlyP6cyjSPpPISnUcNH8HBRF8XscGM0zgrtsq9YMvJCbOascyJ6SYle3K 5+lplx4rOZBELiGFXi7Z029vg2gzMC0aiSCWP/xkR9Zj42Ur8ylSVCaRV6w/kOkYPsRI NCWMbQlXq7eyk4aNHKTwPQQYIk6ntQG++EF1z3KRTnDa5JBk2tRP7dJov/Sgzp0Jnu5a SVuV3RCSgr6Qe2RLxTELd34T9s4IMJbMo5I1OeLdPPTA68gyCEv8RiFwF6w3hkirjZTv /fhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769786199; x=1770390999; h=in-reply-to:content-transfer-encoding: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=9si664lpAABtSRH5NCDTNiWW5Zo1E2FOdd2kZn8cRsw=; b=vPSYDJoAKXhCkO84F/34Eu0PShJAZuETqiFSHfInU7sC+03pkVyN5NBgSgesOYoZKc GOMIci4TkoN71rablPxqUvqy6UpHY+N2h5sgIXOOtwqTq/DX8X6JFwxVyYfytKewMaqX hBLLOWj2//WWwxGwAp4udBX3Bt+TGYTXa8cx1Z7hd4MXhosGq0qqvONTlDVKAsmVl3YS FmMs9kGviCc3K9jAf/x3tnkhxPILQR+alNQP95uqJY55xXUXhyQsmBHLowpKdUiCI/EB ivFH+yg7PLE2dLaVze0AVLJ5UFECYR11Q0ukIG/8qTbfjGOjguUeDmVjj+hu6jM1Z5Za aJmA== X-Forwarded-Encrypted: i=1; AJvYcCVdZiqvIAVviZEs4p5GpykYdjZxd5/UYVRTmWL3WnqAlTvrqOi/IYbnTela164h740P2vRfhgiHE1AHUYE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxt3hLh4UrfPSMKSj5590NLnXtndTJ/hKK/RQ6QnNmYNrpWjR4j 8soskoqyMqK3CzXk46FkIHxnaihqu02JJkWFQJ5b8MfK6e+BSHiJHMJD3oHvnrh2Igs= X-Gm-Gg: AZuq6aKY0RwIrjWBoFYE4nWKvTupsTqPvJdARn7KESs4nzROdwRugRmLwUNPLcjmDeD C/fUAPTW39juybFd3OFhiGxmlSmBhOrVX8jTHAIjM9c5bcNfCS85LTf2XP+OnnyWeOC050L2IcU AOKTNMqTIWhkfcr20IKCXIN8oFjdmHqgxGFBb9H2u/thU5Wd4ploEO9UZdAD2zqp/d7u06ZjC5/ 6wXWpB/qILjvot+i4kNkuIwdIrBIenMgp5oonAHggSkbbfWFdYpEdcIrRLeGOanU/aByTaNx2mI OFaQJdxSvt4fbrFwwAJiu0pqx5MS54U/6kpeX/z1kK+dkddLRARjejQsvU1qvWmVfAVqP/9Tz76 nShJ/YH4zjK1uEzn2RxbSuZsWa1lKbAmcyRi+NBrpnjtKHQ9ZS/WNPyNGKE9WjRM8pIUoZNHxH+ ZyFgKVdrZmGgW9saHhmnMrixL/sYIYwc4wnBbSNerlESruFfAK0U2ToH+pj6ZP0IQhe3Y= X-Received: by 2002:a05:6214:501d:b0:88a:4c50:3be0 with SMTP id 6a1803df08f44-894df970109mr86470926d6.6.1769786198441; Fri, 30 Jan 2026 07:16:38 -0800 (PST) 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-5033745c5d4sm58414081cf.3.2026.01.30.07.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 07:16:37 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1vlqEe-0000000BAef-38VG; Fri, 30 Jan 2026 11:16:36 -0400 Date: Fri, 30 Jan 2026 11:16:36 -0400 From: Jason Gunthorpe To: "D. Wythe" Cc: Leon Romanovsky , Uladzislau Rezki , "David S. Miller" , Andrew Morton , Dust Li , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Sidraya Jayagond , Wenjia Zhang , Mahanta Jambigi , Simon Horman , Tony Lu , Wen Gu , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, netdev@vger.kernel.org, oliver.yang@linux.alibaba.com Subject: Re: [PATCH net-next 2/3] mm: vmalloc: export find_vm_area() Message-ID: <20260130151636.GF2328995@ziepe.ca> References: <20260124093505.GA98529@j66a10360.sqa.eu95> <20260124145754.GA57116@j66a10360.sqa.eu95> <20260127133417.GU13967@unreal> <20260128034558.GA126415@j66a10360.sqa.eu95> <20260128180629.GT1641016@ziepe.ca> <20260129113609.GA37734@j66a10360.sqa.eu95> <20260129132058.GC2307128@ziepe.ca> <20260130085131.GA122673@j66a10360.sqa.eu95> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260130085131.GA122673@j66a10360.sqa.eu95> On Fri, Jan 30, 2026 at 04:51:31PM +0800, D. Wythe wrote: > On Thu, Jan 29, 2026 at 09:20:58AM -0400, Jason Gunthorpe wrote: > > On Thu, Jan 29, 2026 at 07:36:09PM +0800, D. Wythe wrote: > > > > > > From there you can check the resulting scatterlist and compute the > > > > page_size to pass to ib_map_mr_sg(). > > > > I should clarify this is done after DMA mapping the scatterlist. dma > > mapping can improve the page size. > > > > And maybe the core code should be helping compute the MR's target page > > size for a scatterlist.. We already have code to do this in umem, and > > it is a pretty bit tricky considering the IOVA related rules. > > > > Hi Jason, > > After a deep dive into ib_umem_find_best_pgsz(), I have to say it is > much more subtle than it first appears. The IOVA-to-PA relative offset > rules, in particular, make it quite easy to get wrong. > > While SMC could duplicate this logic, it is certainly not ideal for > maintenance. Are there any plans to refactor this into a generic RDMA > core helper—for instance, one that can determine the best page size > directly from an sg_table or scatterlist? I have not heard of anyone touching this. It looks like there are only two users in the kernel that pass something other than PAGE_SIZE, so it seems nobody has cared about this till now. With high order folios being more common it seems like something missing. However, I wonder what the drivers do with the input page size, segmenting a scatterlist is a bit hard and we have helpers for that already too. It is a bigger project but probably the right thing is to remove the page size input, wrap the scatterlist in a umem and fixup the drivers to use the existing umem support for building mtts, splitting scatterlists into blocks and so on. The kernel side here has been left alone for a long time.. Jason