Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6724165rwd; Mon, 19 Jun 2023 11:16:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4abb/BNL7XwzuqhdlGl6lxANHWj1AIwS5ZBKoMMjuyCFybSk+RJxe/nnFJwFngVk7kHjyy X-Received: by 2002:a05:6a20:5496:b0:121:a6b2:2f10 with SMTP id i22-20020a056a20549600b00121a6b22f10mr5063073pzk.49.1687198597910; Mon, 19 Jun 2023 11:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687198597; cv=none; d=google.com; s=arc-20160816; b=ptrv8Am3312X02WGIsCIAuC8DaPkX/Qd1Q4dbbN3M9p5xUNTOE8CAzxtInekrGDZRg b/PwUijxlCjN68mkQRCe+AKCgdgW0RlE7raMeQaWHSgHNMQpdovE/vjApdmEi6q0tNt0 SVf4gqmxM2TN8MDXZ0Lzl+apbzBRf/qAVOXApyGusW+GoHbWgXOqMGJ0IhqOxToOr/e8 vmJJdiNKA9Ger8h8INn+MG5fi2nCf37IKiXlEkPbV2lrPpG+m2MKyNyx66J/Dm6LgwcR vep65a23Ag3ICCziM1zLoUDiyvcX/DNpCXv7FuS6pb+c7cyfFwA7aR7r15pZE5d+wJW5 dprQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=m9etyL7yjw4qdVvUE7weN4tVPxp2Aw8uM3WJ1VWvFuE=; b=EtQRfmT+2z0qCA+Y9Jj4jjPWBk4vlSvnJAal7nlOZAmoVyXoFI0N5TA9Z8EQmA5C2Q XwtmEnSTr/9IZ30vNkrFmO4qv7KmJAvOai5p2dfw4Ht/TPQ1OICo6LWtgrwA+cAnELnb JWvh1xgd7+e3etPU/uB9RFZTiYq0Z52P8uBYn0H1E7zNGNsfwHKfJzkqBmxWzUfrdGTq ZVFzLsmdgjcitdLBgMN2J3iZ1NcQ41ygmcBwz7nI/KS1siL1VoWuPejQ+e5+YiDmDHEk CzF9NeYozCvD2cINglvwe3/Dx2sXAFdAbJwa6eLG/VOnhGgJ3zCh99hJ83iudPBLxQcL OR5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hnq0AOip; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p5-20020a637f45000000b00553ca769598si4288pgn.761.2023.06.19.11.16.22; Mon, 19 Jun 2023 11:16:37 -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=@kernel.org header.s=k20201202 header.b=hnq0AOip; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232159AbjFSSHK (ORCPT + 60 others); Mon, 19 Jun 2023 14:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230184AbjFSSHK (ORCPT ); Mon, 19 Jun 2023 14:07:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CD9D120; Mon, 19 Jun 2023 11:07:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 45EB360DF4; Mon, 19 Jun 2023 18:07:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B85C3C433C8; Mon, 19 Jun 2023 18:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687198027; bh=XNrWx0e+VFb0jaH8wmeXcZNg0osk8eDrh+qYB5nAfyk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hnq0AOiprtBC3qrex4NKnoSCrfoj8sJY8nyfDOYmMWS+LAdWlLROaAKj8NrHdAqKV gVhM8EURFdB3wFLNb5+cKug0R7eGHAYnxKLQtws1cQD1w4jy4qo3Hb7J1+QEk+tsBU CwaUfd+n40I3VQBfJ115llahzE5XrSWAEPqImjrhQ0Q9+4yBUo9WuCwv+e9Jgp1nFc JK4Y6V1bPN+wKsKswtz5r475G3cj3+O1jsBSXMG326is1pnTd64o/YSXvOjdb2TDxy /MScaTumbH45kNF4b2HPmMzPaXxYXkmbDyTzbrZl34qcyt4Si2iWxAdohcw8Fn2wxj eAVJ5xQrBneyw== Date: Mon, 19 Jun 2023 11:07:05 -0700 From: Jakub Kicinski To: Jesper Dangaard Brouer 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: Re: Memory providers multiplexing (Was: [PATCH net-next v4 4/5] page_pool: remove PP_FLAG_PAGE_FRAG flag) Message-ID: <20230619110705.106ec599@kernel.org> In-Reply-To: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Fri, 16 Jun 2023 22:42:35 +0200 Jesper Dangaard Brouer wrote: > > 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, Perfect, that's also the use case I had in mind. The huge page thing was just a quick thing to implement as a PoC (although useful in its own right, one day I'll find the time to finish it, sigh). That said I couldn't convince myself that for a peer-to-peer setup we have enough space in struct page to store all the information we need. Or that we'd get a struct page at all, and not just a region of memory with no struct page * allocated :S That'd require serious surgery on the page pool's fast paths to work around. I haven't dug into the details, tho. If you think we can use page pool as a frontend for iouring and/or p2p memory that'd be awesome! The workaround solution I had in mind would be to create a narrower API for just data pages. Since we'd need to sprinkle ifs anyway, pull them up close to the call site. Allowing to switch page pool for a completely different implementation, like the one Jonathan coded up for iouring. Basically $name_alloc_page(queue) { if (queue->pp) return page_pool_dev_alloc_pages(queue->pp); else if (queue->iouring..) ... }