Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1050170lqj; Mon, 3 Jun 2024 08:44:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfAKuvF138pW1YQVTpHzDqaIiyuaIEKZ/vFh6hiDga+nusb2oZPV3FMfLL0ZLxOwaUufZ9u739KZj/+W5x8zrMJc/jL8qnV9tneE9NLg== X-Google-Smtp-Source: AGHT+IElCS6fHvBAUMVDQCH+94PGmnlVV+MmvULyB1L+vYcxlwRroNxL+fOLfSXiFwoo+2YJWBOj X-Received: by 2002:a50:d503:0:b0:57a:2f68:fe7b with SMTP id 4fb4d7f45d1cf-57a36419606mr6677232a12.31.1717429477540; Mon, 03 Jun 2024 08:44:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717429477; cv=pass; d=google.com; s=arc-20160816; b=y9zjdGylv074IcHxEOzI83U+HQKjcIQhRnUpiaTRRdBbY0zJuZ/+kLk9qNNxpZM7F5 szsNlcX60XxA1Nn2nb4zFwmlPwRmmkxpSLP8XtehOwx3SUawfVawvZA4wRm8EalADs3P lfguzL8iDJAeaxwEUxC6ybbGERarElCKaw3ddWEacQx4mpVjl6H1uC3ukxFC20n9bR+B w1zkxzcTuVDMCg651g7NO5ScJmGMWtE4r4BltDR1gGByfyD4x/MR2p70EBf281nt/+eZ 8pa4UBWxYSNzs6e2k5i42gEaAOeJ1sf8arTfU3o6elIt8QCZplbETmxAICxh9e/3xhLu gHwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=rqJ9wkj5wZpDYGPbIA+rqZwe8IgS9OX1IL+4hKpxPn4=; fh=YDLtUfKXoFz3TKA/flzRCWFvMq/tfjMnFuAKpWG0QIQ=; b=poQ0Qie6r3VVRaNV04hXQpsk/onj4bwwFHleJOuGrwKsbRzD8Lg2c8E89cbMCPpy8L GY/uzVUBkHqQ2dE3x6RJ3P1L5+Wp4tv4Yugl4t2NE4rZnjx6frwLWqF7IfiYJOeWQzUj 8Zzuh+ZQbk/r3+r5aCwmcLRQC/ZXRNznz+96QVaIQBy50g0RO8uKD3Be5pYWuP6nXawu uVu2sM2XndyDcXDwlrzKdiPSuP62/CQQvitEuGBkhqkpXGoF3114xAkyOSeEh5J6Ow8M eQ9kBfLYMfT0evR82MxHVhlFe9JspdLVMEXNxJ0ZAPyLGxvBVXgNijhqFEyv4b5o6FHW iXig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=g2pGxbPQ; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-199380-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199380-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a6af5851asi456839a12.559.2024.06.03.08.44.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 08:44:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199380-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=g2pGxbPQ; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-199380-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199380-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 3AB5D1F2219E for ; Mon, 3 Jun 2024 15:44:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB16413212F; Mon, 3 Jun 2024 15:44:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="g2pGxbPQ" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 E50151311A8 for ; Mon, 3 Jun 2024 15:44:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717429458; cv=none; b=Atm7FZJgfTWX3RhyV5KNL66tWltPQ4MZjaaMw4jBP1VQANp8Vy8IUxoEpI4NF70ub+FgyG5UGlTdWkTN+Z7etli8oyZvGs03F714rb72HiN+ZAwPsrCK2HysQn9g2aNltqCcbP0iBSFGKuNgCTF5IUuHDrnz4i/VxR8/awtgcfI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717429458; c=relaxed/simple; bh=ViCOgp0Yz/a1mBDif8ovCtOgE1SFPQZh2StHW9aA04A=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=I19txnyQ3WHd/BHmf4knhmoZ5uDbzD6KGnjN6VUdpI7akIjD2KXUO8Px3IOWSD+/IMWBAhEzWAq0OE0R4uKq0MWNtnmB5+83q6t1lwh5R1wydPEJR891Pof6NFEQl1Lc3jb3KMmjszvFGd+aPxbl/Kpnro0SmJ5psRDD74EVEns= 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=g2pGxbPQ; arc=none smtp.client-ip=209.85.218.52 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 Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a68e7538cfaso215904266b.0 for ; Mon, 03 Jun 2024 08:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717429455; x=1718034255; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=rqJ9wkj5wZpDYGPbIA+rqZwe8IgS9OX1IL+4hKpxPn4=; b=g2pGxbPQ9ZGPb9G9nYOHHhrxTVOtUJfV9458zm88if8hA13aqyLDEJipAGSqvX8TB+ FTasRCdH7JHpoINO3WVCONpJheLxEsaNr8Ef1yGDiBNaN2RxJ2Nzl7ihOG9ZAEaFdOK8 GfllnyypXe50GRE0mPPo+THrRNvBwWfaWOb29haboSGS4whavBCCiCEYHNIDHW2u3Bj9 mcWO3d1uQJfuFBZAa89/mW4CLtQsdh8Cx0waCMTKIdowIlPddY3GDPmhoWU9o7SJrLe7 i+0l2jfSFXe46fNY2b0ovBZWKMpvDDMucWgOaO7ZZamsjmtZbL3/zRbXMaKnUCQTMx1t 8lGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717429455; x=1718034255; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rqJ9wkj5wZpDYGPbIA+rqZwe8IgS9OX1IL+4hKpxPn4=; b=lvnApIs3jJ35kkGe4efPYIbaDCM9jCuaL4+kDFRI1NFnsYsRVe+jk/5tcpgbNGu4ZP Lo/d7ksYj32mB5cEezdfocz7fHez9RruvUYtNAdWsF7DeSsTJU0u7Mn1MZ126tuB3XRw It7QIvJ5Paz5LYCeoyZq5iOGGuIB3ct02wzZxIEk+9siBpLmFVslgvKSxR4uxiC6S3FU f/cIAcpORHRVKjz1rlJAJB/xDlfucM3AJNyZ+ozFZ4S8xAxfW9mFhkBukl0yofSrJrZd e+d4ZXsLcSpj2ZAL2obYjdlCM1DaGs4er180ff/HBu1AU++VgCm1qRBDdah9m+RLsPK/ TX/A== X-Forwarded-Encrypted: i=1; AJvYcCW7JZDbVE9FNTrqMwiYmW96T2AoP9BkeFBAVbnZZGxmdhsDuW6+GATqmysnqS1yw5jiJCBwY2gHwQGg9RncfDPubChz/xwen8mo+TAU X-Gm-Message-State: AOJu0YyX9tnlSXR/ek5TEjgT/YAphlqzVDYm/yxf8D+yJEK6wG+5zlwu /74nS9aMV+QcwBenv0ktjEAx+a/31cXSZBWoHfaLBSgMwsZsodfDcEnHCxzlpnJuaXxjm4T8spp H+/1hG2DpkcB9/1+/vsFYimh087M8NqfiNc2o X-Received: by 2002:a17:907:3f28:b0:a68:5ac4:3aaf with SMTP id a640c23a62f3a-a685ac43be7mr699125166b.41.1717429454535; Mon, 03 Jun 2024 08:44:14 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240530201616.1316526-1-almasrymina@google.com> <20240530201616.1316526-3-almasrymina@google.com> <5aee4bba-ca65-443c-bd78-e5599b814a13@gmail.com> In-Reply-To: <5aee4bba-ca65-443c-bd78-e5599b814a13@gmail.com> From: Mina Almasry Date: Mon, 3 Jun 2024 08:43:58 -0700 Message-ID: Subject: Re: [PATCH net-next v10 02/14] net: page_pool: create hooks for custom page providers To: Pavel Begunkov Cc: Christoph Hellwig , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 3, 2024 at 7:52=E2=80=AFAM Pavel Begunkov wrote: > > On 6/3/24 15:17, Mina Almasry wrote: > > On Fri, May 31, 2024 at 10:35=E2=80=AFPM 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 serie= s > >>> 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. You don't need to re-send the same ops again, right? You can add io uring support without ops. Something like: 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_op= s) - netmem =3D pool->mp_ops->alloc_pages(pool, gfp); + if (unlikely(page_pool_is_dmabuf(pool))) + netmem =3D mp_dmabuf_devmem_alloc_pages(): + else if (unlikely(page_pool_is_iouring(pool))) + netmem =3D mp_io_uring_alloc_pages(): else netmem =3D __page_pool_alloc_pages_slow(pool, gfp); return netmem; So IMO, the ops themselves, which Christoph is repeatedly nacking, are not that important. I humbly think the energy should be spent convincing maintainers of the use case of io uring memory, not the ops. The ops are a cosmetic change to the code, and can be added later. Christoph is nacking the ops because it gives people too much rope [1]. But if you disagree and think the ops themselves are important for a reason I missed, I'm happy waiting until agreement is reached here. Sorry, just voicing my 2 cents. [1] https://lore.kernel.org/netdev/ZjjHUh1eINPg1wkn@infradead.org/ --=20 Thanks, Mina