Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3204567rwd; Fri, 16 Jun 2023 13:57:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6FCzNlKa5Tp+JQy1XzOX1B9Ec/98HyjDyub9bN26WEr9vWDQp6BS0iI3XyPegW1XuoYftM X-Received: by 2002:a17:902:ef96:b0:1b3:7de7:f83f with SMTP id iz22-20020a170902ef9600b001b37de7f83fmr2592892plb.26.1686949051943; Fri, 16 Jun 2023 13:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686949051; cv=none; d=google.com; s=arc-20160816; b=FjG4L3LOEyZYwfD3c3x7jTtGI0kVmxtPvzcp56xRhNTNAXgWTcW2lkkd2OnkLsZRCl C2Yu40wEti8ZqR7oVRufSN4FZru9lYgFAHN40Dn4SQ3sJJ8sUF5K2EY7+edBFU/t9P0l Gmx5VvaSEhLFUBSQ73REBR1+vCAiqho0zmmJMZ+JneVinH3ztW61gV5qyPeYS5fspLtv 18aujWCuYX/EAYywlQNNYBP1jXCuKFbtv1H/JPrp/WFkj7UVP1pqyxqCCj04/26NFN0/ T8tX6gal85LmyphWRvN2u6hXRo5rXv4YhQRDN4MedHTm3ByLbAUnAMpsCy4CNfrnYmFO dGVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :to:content-language:subject:cc:user-agent:mime-version:date :message-id:from:dkim-signature; bh=NSJLIyj9LMYS53Im9VxxQ75KAnWRMymE9tH9+QGjBNs=; b=G1RHvg/iFmqx1+IZVAiiw6wieSmfulioszqxP+962R4kKMPj84Ok//gQYBouobPDFz qcBTeg7907RO1qjRZHdBAk/ZlNgtY4SHj9fddedPmur/v65eFhER0hLX8wQzIu8KXYYu 0DKZdLESdluANvuvrJyo2B71cOeNax+OTym/5D/0xArPiNpaHM8mG8YoymXsqyWWgmwN eFRftdBXGozIaA1A7BxuBbsRDeEc3Xg7RRkDUfjdembV2u7l0LNSUfyI5bbiCsACIu7Y 0v/DPci53F/ScEDktALD2A+/KSlqWFnbx40FvzLJ+pksa6R2wserELSqHJff450ZelLO N6Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c2RjwrsR; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a170903124800b001ab1ba2572csi16398666plh.240.2023.06.16.13.57.20; Fri, 16 Jun 2023 13:57:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c2RjwrsR; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbjFPUn1 (ORCPT + 62 others); Fri, 16 Jun 2023 16:43:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjFPUn0 (ORCPT ); Fri, 16 Jun 2023 16:43:26 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FB033AA5 for ; Fri, 16 Jun 2023 13:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686948160; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NSJLIyj9LMYS53Im9VxxQ75KAnWRMymE9tH9+QGjBNs=; b=c2RjwrsRtZ2UodpnaZbHhL1TvE4NnmjHTU8PAXlk+MDxCNF+4KMo8woWaasYPRG/isZm2b Jx5UtHLQT7DEuy/lPpUq4RKPj20J2xI8rQp5bsbqbNlITqygBs9z1wkpjNZ/IIQX4JCcPk 6ACfiwSoN9+sO9psN1htuoJt7FqQyYg= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-433-djAZHkt_M3ClHKp4cQM4hQ-1; Fri, 16 Jun 2023 16:42:39 -0400 X-MC-Unique: djAZHkt_M3ClHKp4cQM4hQ-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-94a34d3e5ebso77178766b.3 for ; Fri, 16 Jun 2023 13:42:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686948158; x=1689540158; h=content-transfer-encoding:in-reply-to:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NSJLIyj9LMYS53Im9VxxQ75KAnWRMymE9tH9+QGjBNs=; b=UG72VLnRQ2FMEDc+s2WEX9M7GVGtkAWNAi5sgiiR7+MaXnlDTubCs4ceZpANv0A/t5 0QR2t1DB9hWTGohD98VBkRS3JCi9ZXt+A6Nisa5/BUJ95T1u7q4pnh09Dkd7dsHVQTh3 yCXBfvo5D6m5LiVMTbsdgLmJ2ABTOFzhddhE0tlr5pOAj9xv0iOS2Kk6DmjSWrODDjRw iSGiw9Ihy0KGYyNT1O1w70TfosAPShxPe7yNqShzbeBjHzxXDCroPQhTyKgbQoY4o6Nc aPO8IGZglksYJBZ5zFb+TIKBwZDCoyWNybHD9ZUd/1Ge8/5WPk6L5xkFhGNCNGHFz0d2 WsgA== X-Gm-Message-State: AC+VfDzFRuGVUASGXFLp+YVtkpQfPtx1hOW8Qc0qzbZmc8pwY31Zfbip cCmYJV9dpwvroOmz46fvH2njawV9rCOdh9+tLteE+cWGaB6xPxC5FI8tdxneaWQfdmGwoKjGzmZ TQI7KuX7xaVPCJ8XoHXorBgDrrMU= X-Received: by 2002:a17:907:97cb:b0:969:f9e8:a77c with SMTP id js11-20020a17090797cb00b00969f9e8a77cmr2710824ejc.64.1686948158075; Fri, 16 Jun 2023 13:42:38 -0700 (PDT) X-Received: by 2002:a17:907:97cb:b0:969:f9e8:a77c with SMTP id js11-20020a17090797cb00b00969f9e8a77cmr2710788ejc.64.1686948157766; Fri, 16 Jun 2023 13:42:37 -0700 (PDT) Received: from [192.168.42.222] (194-45-78-10.static.kviknet.net. [194.45.78.10]) by smtp.gmail.com with ESMTPSA id b19-20020a170906491300b00985036aced0sm1439806ejq.163.2023.06.16.13.42.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Jun 2023 13:42:37 -0700 (PDT) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: Date: Fri, 16 Jun 2023 22:42:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Cc: brouer@redhat.com, Alexander Duyck , Yunsheng Lin , davem@davemloft.net, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Bianconi , Yisen Zhuang , Salil Mehta , Eric Dumazet , Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad , Saeed Mahameed , Leon Romanovsky , Felix Fietkau , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , Jesper Dangaard Brouer , Ilias Apalodimas , linux-rdma@vger.kernel.org, linux-wireless@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Jonathan Lemon Subject: Memory providers multiplexing (Was: [PATCH net-next v4 4/5] page_pool: remove PP_FLAG_PAGE_FRAG flag) Content-Language: en-US To: Jakub Kicinski , Jesper Dangaard Brouer References: <20230612130256.4572-1-linyunsheng@huawei.com> <20230612130256.4572-5-linyunsheng@huawei.com> <20230614101954.30112d6e@kernel.org> <8c544cd9-00a3-2f17-bd04-13ca99136750@huawei.com> <20230615095100.35c5eb10@kernel.org> <908b8b17-f942-f909-61e6-276df52a5ad5@huawei.com> <72ccf224-7b45-76c5-5ca9-83e25112c9c6@redhat.com> <20230616122140.6e889357@kernel.org> In-Reply-To: <20230616122140.6e889357@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 16/06/2023 21.21, Jakub Kicinski wrote: > On Fri, 16 Jun 2023 20:59:12 +0200 Jesper Dangaard Brouer wrote: >> + if (mem_type == MEM_TYPE_PP_NETMEM) >> + pp_netmem_put_page(pp, page, allow_direct); >> + else >> + page_pool_put_full_page(pp, page, allow_direct); > > Interesting, what is the netmem type? I was thinking about extending > page pool for other mem providers and what came to mind was either > optionally replacing the free / alloc with a function pointer: > > https://github.com/torvalds/linux/commit/578ebda5607781c0abb26c1feae7ec8b83840768 > > or wrapping the PP calls with static inlines which can direct to > a different implementation completely (like zctap / io_uring zc). > I *LOVE* this idea!!! It have been my master plan since day-1 to have other mem providers. Notice how ZC xsk/AF_XDP have it's own memory allocator implementation. The page_pool was never meant to be the final and best solution, I want to see other, better and faster solutions competing with page_pool and maybe some day replacing page_pool (I even see it as a success if PP get depreciated and remove from the kernel due to a better solution). See[1] how net/core/xdp.c simply have a switch statement (is fast, because ASM wise it becomes a jump table): [1] https://github.com/torvalds/linux/blob/v6.4-rc6/net/core/xdp.c#L382-L402 > Former is better for huge pages, latter is better for IO mem > (peer-to-peer DMA). I wonder if you have different use case which > requires a different model :( > I want for the network stack SKBs (and XDP) to support different memory types for the "head" frame and "data-frags". Eric have described this idea before, that hardware will do header-split, and we/he can get TCP data part is another page/frag, making it faster for TCP-streams, but this can be used for much more. My proposed use-cases involves more that TCP. We can easily imagine NVMe protocol header-split, and the data-frag could be a mem_type that actually belongs to the harddisk (maybe CPU cannot even read this). The same scenario goes for GPU memory, which is for the AI use-case. IIRC then Jonathan have previously send patches for the GPU use-case. I really hope we can work in this direction together, --Jesper