Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1016674lqj; Mon, 3 Jun 2024 07:53:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWkMYlZeUM+U5eWjnR0hlrAfE0vkpg8B2qc+5ZQy3/BjKEPKHJdnkahLCVeTGBIXMhqOrL0uUYszj07B6T8XVnY7jyewEZLB8C8dHWa+Q== X-Google-Smtp-Source: AGHT+IGbw16ILdyc+KkK3SCXppB/gURNy5p8sTS0cgk5mYA3To4mVXTq5SjAeDvlNakonIdPn7+D X-Received: by 2002:a05:6a20:1044:b0:1aa:48d1:2144 with SMTP id adf61e73a8af0-1b26f28edbdmr7344170637.52.1717426434895; Mon, 03 Jun 2024 07:53:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717426434; cv=pass; d=google.com; s=arc-20160816; b=Z4goHSBc78aUl7nrANNW4duAAeViKtIf/OYHHChs67RRwcyiZ0U56DRI+ZofEUQnle pi4WqNNYAb0q8FI2jQg77KUyvbVW1a3qg7kPtJT8HTuHAsdyVno3VFLb6Ept0NsCLENQ KJwSOc7T2jcCp/m5u+VdH5GMzB1h6gMKtPaepTQJWSYN+EENIVXnkvDNqmvTA3SB5ucU g4nh3+pLG8Dqdu9tcGJnvvWJlJzGcj1wcfRP+kNWZT107QceuvqcnyZ/rOMBZP8ZGRpD AAicx5DPeJl2RP407wKIT0TCY4kUIdx4Yl6fWSGXzuA4UcrDJ4sxqslEaY9UROJlae9k w8uA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=DFaFTQnu+hpbSIZgsrwPb2+pTUe1zvaznlAq9n5uYoY=; fh=rkK7h0ZlrXxD6xEOjje/uY3wN64vTu3SKk7n9jDGw/c=; b=kHa09WV9ugYRGT7f7Ht8usJ22aBefzd08/Vwws2t4I1+UlDdkO5xgy1FLH3VEXhPX6 UDZ9KerpE7Mwljk4cb+BGW++ubzszhWUe7e+viKfEmWgWa5S/y9uWZKL8yw12VbxSDEG JqY7gzu/atFAE1QU+qp0FcaHPCbEhuDSW4aZ1wyOGE3ES18ya4yTtNNYsiudlr7IUb6E 4r8ZUZcFpbQMnx6Zok4jHdhY6vyCjujlCmLcCSA/0MeQPo3eiQ8dRbeimLCX1btT1uk+ Ia29IAJma8te1xc+AbsehahazJ9fJywLUqVC7JntySdrO2c++hwDOy6iFSl8R/Bqb+vb jV8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bSOJ0OvT; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-199319-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199319-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-70242c2906fsi6514508b3a.272.2024.06.03.07.53.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 07:53:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199319-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bSOJ0OvT; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-199319-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199319-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AACAC289E21 for ; Mon, 3 Jun 2024 14:52:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C21C130A7D; Mon, 3 Jun 2024 14:52:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bSOJ0OvT" Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 EDD2112D1F1; Mon, 3 Jun 2024 14:52:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717426353; cv=none; b=DJbMyFL2arg6hGGFdAcpSVfz4j7/npFDdEA6Toa4p+w0kuLqVIjlUxtKzMOLleRk5zbLLSh1ac986ZmVoNcc/q1EKoaWEuQKOS7AzU67BF74c3IjEqSYuiIIqHNukscmGTImHPHEj4JH1d2NRQP3f41zTFXBHywIWctx+yTLttc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717426353; c=relaxed/simple; bh=wUNte8raa3GqYXUgFYODM68puHDovUgTvfDgiRlKYMc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=neP7fDPI0dSpGsPQnfLvEiNjOdkO14vRz7R9q0I4rddZrcptOYk4TMss/a6lxezKa8lIyZZ8U7FoVipRtHtYB9M+lLnoZhw+nrcW6hlyMbSA0JdohO6eM0NTDrxkrg1+dmCgg4QzMxwwx0UTpQdrWFbwZwdIMrr+Cgs/88js3q0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bSOJ0OvT; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-57a196134d1so5146942a12.2; Mon, 03 Jun 2024 07:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717426350; x=1718031150; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=DFaFTQnu+hpbSIZgsrwPb2+pTUe1zvaznlAq9n5uYoY=; b=bSOJ0OvTjP8vrjy05Bk9TWU5rOdYIKgAA3ig7VgB2lctXYofvXD9c1bxyVPoIV+3ex CmniemwQa56LWyjGYKKxqEev8/i2KI4X6Epd3QwOaAqiyElsCM/3ttuAiSA6xkTDvlm7 sFyrIPjMN1CKPsh3cCdqaa62i+qh+DuwZ6BoCFdFZBMsV7rRNl2s9D8epXjNXp+EFWum RuYDfeLJoza8KhNi2VumW9YWTOwJzDOSo853rr1tNGfGVbZwm29UWpBe/CVm5vutGWpT WWKzUixAtCru5hOmdWcq4PxNkis5/9lWkL1CNt+A1tG13gC7ZF55v8xOxPUqLiKOoJ/Z HroQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717426350; x=1718031150; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DFaFTQnu+hpbSIZgsrwPb2+pTUe1zvaznlAq9n5uYoY=; b=hFr5msJuZkCJXM97flLvUFYlR/dzCligi5eNTXqwH8BZdz8IvIx8FXJ1IUx/dP9zHf dqo/I3CI3GPU0rZbPo3sq3vQ4y1QmGtdgY0W62AortJA/1PFlTcREDlNj+1Enkz3VXMt ngFpmO403m+QN8HSKxVNx9d5wpXpSr5og2LuZ3kdn9oue9Bm6LM6MknTCwU2/7UEYIOh VQPOMgy3f722aFIP60uU+G5651KPwLJ8b9p698i+b4aZUXEtj4yGnj8uw0Vet37FRANI rzQVWHtpQhsMOLSB8zAhjjo82AN08KOWKKAQoyDmINyxG2TRaGGfnXfak0Ak8qxkBmRT TFxQ== X-Forwarded-Encrypted: i=1; AJvYcCWwFZs367fR/S68blWftiFku6Zgz/ldtFYIvA9dhqX7bdQLllfbQBjOHbeY87BfuiDg3IZX0h4ovuTfd2K2hHUtog2KVj09t0H43wYqByYLrtnhwp3RNNn258M8I12SLbk4Y7TY3Njw58f+fFweONMaZrpunRA9elSR2FDidxHJ1h3fq7VsQZFHAtncbEC4vtnbcwqNXZpT/tdZMyp3o6vS62r7rXJY2XG5pVw0mk6wOG346r5lhNKULI4uwM+uEynViK6Rsxta4aFpGAcHNaF7ytBbf1q94L7ccByU/LvsOrb5FzLloI5PrjST3CdXZmxW6K70QoqeyoliZdwf/DdOdEpUbJMM1paZi4NX5Bpn7pqXl6MG4fVN6Lec3vY+be+lN+0eQsj43/yFNlt2guzAQGm5AbeLV7y8FaTLERtaTtDfe2BSOjjp8QFHbmdJR5qnANihc6vfxY4xG8qL1cvwJqBLJGMIvl4KB4FCRw== X-Gm-Message-State: AOJu0Yzu0MPNg6OpnKNa2z6pcQM7v570VTIv8eWfNrgV44NyuIffGEjz 77QUCnFYUoZOEhCCEx/bzC9XIPeHJtdVJA0Ki67ByetDkLIsFogQ X-Received: by 2002:a50:8d4f:0:b0:572:a731:dd14 with SMTP id 4fb4d7f45d1cf-57a36450a67mr5894483a12.28.1717426349978; Mon, 03 Jun 2024 07:52:29 -0700 (PDT) Received: from [192.168.42.244] ([163.114.131.193]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57a31be4df2sm5365768a12.47.2024.06.03.07.52.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Jun 2024 07:52:29 -0700 (PDT) Message-ID: <5aee4bba-ca65-443c-bd78-e5599b814a13@gmail.com> Date: Mon, 3 Jun 2024 15:52:32 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v10 02/14] net: page_pool: create hooks for custom page providers To: Mina Almasry , Christoph Hellwig Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-arch@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Donald Hunter , Jonathan Corbet , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Andreas Larsson , Jesper Dangaard Brouer , Ilias Apalodimas , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Arnd Bergmann , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Steffen Klassert , Herbert Xu , David Ahern , Willem de Bruijn , Shuah Khan , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , David Wei , Jason Gunthorpe , Yunsheng Lin , Shailend Chand , Harshitha Ramamurthy , Shakeel Butt , Jeroen de Borst , Praveen Kaligineedi References: <20240530201616.1316526-1-almasrymina@google.com> <20240530201616.1316526-3-almasrymina@google.com> Content-Language: en-US From: Pavel Begunkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 6/3/24 15:17, Mina Almasry wrote: > On Fri, May 31, 2024 at 10:35 PM Christoph Hellwig wrote: >> >> On Thu, May 30, 2024 at 08:16:01PM +0000, Mina Almasry wrote: >>> I'm unsure if the discussion has been resolved yet. Sending the series >>> anyway to get reviews/feedback on the (unrelated) rest of the series. >> >> As far as I'm concerned it is not. I've not seen any convincing >> argument for more than page/folio allocator including larger order / >> huge page and dmabuf. >> > > Thanks Christoph, this particular patch series adds dmabuf, so I > assume no objection there. I assume the objection is that you want the > generic, extensible hooks removed. > > To be honest, I don't think the hooks are an integral part of the > design, and at this point I think we've argued for them enough. I > think we can easily achieve the same thing with just raw if statements > in a couple of places. We can always add the hooks if and only if we > actually justify many memory providers. > > Any objections to me removing the hooks and directing to memory > allocations via simple if statements? Something like (very rough > draft, doesn't compile): The question for Christoph is what exactly is the objection here? Why we would not be using well defined ops when we know there will be more users? Repeating what I said in the last thread, for io_uring it's used to implement the flow of buffers from userspace to the kernel, the ABI, which is orthogonal to the issue of what memory type it is and how it came there. And even if you mandate unnecessary dmabuf condoms for user memory in one form or another IMHO for no clear reason, the callbacks (or yet another if-else) would still be needed. Sure, Mina can drop and hard code devmem path to easy the pain for him and delay the discussion, but then shortly after I will be re-sending same shit. So, what's the convincing argument _not_ to have it? > > diff --git a/net/core/page_pool.c b/net/core/page_pool.c > index 92be1aaf18ccc..2cc986455bce6 100644 > --- a/net/core/page_pool.c > +++ b/net/core/page_pool.c > @@ -557,8 +557,8 @@ netmem_ref page_pool_alloc_netmem(struct page_pool > *pool, gfp_t gfp) > return netmem; > > /* Slow-path: cache empty, do real allocation */ > - if (static_branch_unlikely(&page_pool_mem_providers) && pool->mp_ops) > - netmem = pool->mp_ops->alloc_pages(pool, gfp); > + if (unlikely(page_pool_is_dmabuf(pool))) > + netmem = mp_dmabuf_devmem_alloc_pages(): > else > netmem = __page_pool_alloc_pages_slow(pool, gfp); > return netmem; > > -- Pavel Begunkov