From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 1CED5372B4C for ; Wed, 28 Jan 2026 18:06:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769623593; cv=none; b=Kdxy/9lKzctnol+iPJtj+ggiE8DaTUXbcM/ektb4FyxBIXKHZB3Khn9c/jNpusaJp8UGtqx+qfB7gTRHJ1PBLKRl1w9P3Oa6I7R4nlvG6LRNg+FHlN9ujLmvnMbFtG6TESlgUSeEszFeYeTyHCP10ReMgD3yEBZwoAlGwsooB3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769623593; c=relaxed/simple; bh=YaIZPczUt0JTVA89TpBrq/++CRfdlHNIhDlOkzrTVzQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sNqfiofPQO4wDCJNbHj0/2uF7BKgey1+w6Z8CIUvRjsxTXJm9NwnzUQ+Y4VfRYVwzg3jsfinagNdxUGvLDmKpU7qPYU5JdAi4xElUgZq9qZZTMAi0P93Ha6AfMk1DB4UmEuPQ8bl99zQoE9/xYou3KXkPP9JJVHJZcrArYAam9s= 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=H8mWeFsS; arc=none smtp.client-ip=209.85.222.178 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="H8mWeFsS" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-8c5384ee23fso19431585a.1 for ; Wed, 28 Jan 2026 10:06:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1769623591; x=1770228391; 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=YaIZPczUt0JTVA89TpBrq/++CRfdlHNIhDlOkzrTVzQ=; b=H8mWeFsSdwADWoWWfEA0w+bwR8tO5PHsGO8YFyoPYpDKG0sMyli8Ex3dHcuo63SAE5 r4Gn6lEHuyjoUITTiyG053SeObk1eqjhP5AGP/tx3s1n/WvyZEqqNNkdn1NUNZYB7Mj8 1majS3rb6gLXjS9Kl/S4X/nshAyAfPVXIRkGKYhVU/ks0d1NMjTPrD3WCLJmYjQ7egD6 x97U1qiMggsHkQCrXUdyxC1z1FymH3HVJjnhE46eO9UXV+l7ZKoGhkW9xrMgkFTt2Q52 NAvCR/D387hBy/DvGoiX1EYiWKTjqS4Pw8T3QNUVmojUjIalMdRtayzMk2OEBNPw2Lzo IcGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769623591; x=1770228391; 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=YaIZPczUt0JTVA89TpBrq/++CRfdlHNIhDlOkzrTVzQ=; b=HGbRSKBH7TvmpHOdzdpfc+0IXK9uT9VWKkRBATJf9I38Bu8OEpvvTMWFdjyuGnVrdQ eep4tOPWxJKqLC0BVHfR8cjAlRE09BJ87uKdk2yBlBC9+oeEG/AqvpMUzv5yVmrp2c6O t5rmFWGFP0Zat73Kro+9O5C5shdMu8+RReE/fUQgJ7eMFwFOMNeXSR/P04o5a5CLnauL I7zyogPSBvPMaIbuWSCkvjOPh0EV2dsvWuJhBqorCjcPK1YQFdffodniarAzTR7c4yTx EV3I4dtwppDX0wsD//cDHnWEYEYrSXBaSidqqwMjSMnYSmcOfQ6Me60OQzg9LU1wxw4F i4kg== X-Forwarded-Encrypted: i=1; AJvYcCUuLq0VVyOMZS+yBb7eIcdtUqCUi9OSvaL/SYhKqgyT4ZEGtI7pP3jOAdhIb1Frado96+x7W+dudHz5s6A=@vger.kernel.org X-Gm-Message-State: AOJu0YyKr+jHbl8IEzBEaaW1E1EG4nGm7QtlbG0NEiySgy8OCkq8fl5F 26FH9Y3saKKrOU9WhyrSWks0zPQKdEQ8KezWCdU/hCxB+M0JiiZfM600kKDdMxCNEFc= X-Gm-Gg: AZuq6aJqL/ObukNgebaeu1JPEcgQBT6mDIvNjlhaxDMhIUjTZqmEPG5LPeFzIqZWnt5 0FTwVABDs9cJq/hp8E7vVKQt0pGKsE46h3UyUQ6ITMsvnqulSev6FmdfRoKqSjDJGSV/PYCq1hC f9XFbfHhWr8HQrXKPI/Nou379/Hnyg2kX4LEG0bklbTyRm8pgFDJqYSjyzJzasN29p349TsRmju Wki3cHlkR6RJwQzpPOoC5iEc2lzYzKpcP8m+LiNl4Ah3GyVar/k6+tKeNtIqnIPGYLlqU2AFttX wSees7NxRGVsyx+xvhLxHW43IUnbpS8ItuH5w3qndF+eIRywfJrzBz/fyeJAseS/hfnm2bGSpuU +eP3pESMv0oSSCG5Ri8UQexO5bKVvxVxCY8NX46HzZAdQHqAmOdtD/8osu520X9gq5YzVToJ9Xf ABONaWruUIun1W0mVopJJQJRK6rTHloWcYFbXTNmsvnCu7RXyQd1LhjCccRGQ6WwIhcXI= X-Received: by 2002:ae9:f404:0:b0:8c7:136e:bad7 with SMTP id af79cd13be357-8c7136ebb3cmr341643785a.85.1769623591045; Wed, 28 Jan 2026 10:06:31 -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 6a1803df08f44-894d375ce71sm21598586d6.45.2026.01.28.10.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jan 2026 10:06:30 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1vl9vx-00000009aHB-3e3a; Wed, 28 Jan 2026 14:06:29 -0400 Date: Wed, 28 Jan 2026 14:06:29 -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: <20260128180629.GT1641016@ziepe.ca> References: <20260123082349.42663-1-alibuda@linux.alibaba.com> <20260123082349.42663-3-alibuda@linux.alibaba.com> <20260124093505.GA98529@j66a10360.sqa.eu95> <20260124145754.GA57116@j66a10360.sqa.eu95> <20260127133417.GU13967@unreal> <20260128034558.GA126415@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=us-ascii Content-Disposition: inline In-Reply-To: <20260128034558.GA126415@j66a10360.sqa.eu95> On Wed, Jan 28, 2026 at 11:45:58AM +0800, D. Wythe wrote: > By leveraging vmalloc_huge() and the proposed helper to increase the > page_size in ib_map_mr_sg(), each MTTE covers a much larger contiguous > physical block. This doesn't seem right, if your goal is to take a vmalloc() pointer and convert it to a MR via a scatterlist and ib_map_mr_sg() then you should be asking for a helper to convert a kernel pointer into a scatterlist. Even if you do this in a naive way and call the sg_alloc_append_table_from_pages() function it will automatically join physically contiguous ranges together for you. >From there you can check the resulting scatterlist and compute the page_size to pass to ib_map_mr_sg(). No need to ask the MM for anything other than the list of physicals to build the scatterlist with. Still, I wouldn't mind seeing a helper to convert a kernel pointer into a scatterlist because I have see that opencoded in a few places, and maybe there are ways to optimize that using more information from the MM - but it should be APIs used only by this helper not exposed to drivers. Jason