Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3325963pxj; Tue, 11 May 2021 01:44:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXGFC2e1D7H7W4o2EujVXlQ6smmynnRZtYlix5rbc//Bil5z/h0+xh1IhG9JHsLmmL9Dh0 X-Received: by 2002:a17:906:abcc:: with SMTP id kq12mr30672187ejb.97.1620722658566; Tue, 11 May 2021 01:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620722658; cv=none; d=google.com; s=arc-20160816; b=mIo7AE48XMWgRiwT6du/2hbsZ4pZwzcry5Tyx7P3XZZRuvsJOqEBsE11jig810eQ37 YxkIPyA0+Dl7XX3yKeoPqlxGwRc7UAbL3KIU+tWf9GpiQZr2aEfxkyYDzel5UUuCfH1d noOW/vH/uYpYcTFPsOpLmmmooaRKiCt0C2AAMI0TYViXnzJQPGM9+nTAbeZrjzcAcN4R s8SsvCsZ1RLavmlIV2YUMfSDiA13wwgX9KvMLAow8hWT7pIojRWpOvFArVVe3DMOU8vt snVkermgCf/3b4mmlzrZTEVJHZ656guSDKruzuxHNqK2z91P5tBMsAzcrzjz3af7pvzs 9mwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DBeVQ+DbzVOqheKpDE6b/l8xGHNgrrKmzCyeg4MY9MM=; b=ft1QDUf7nSajhrEyhMXuzeiaUvU5RrBZf0ieUqva6IB2OX1bTLiXXL22JDZD295mEd ChZinhZYUd6JUd6JTXW683/kna18PIFkvfWvzSRKqM3GScgNaVVdAJCnYpDosS55m+w5 KzYpeH1BCDOdsCMAWY+050k2ZL5n4yOoGu1Ovu7u/w5MW634RhwGCd9STDx6RnJS110t c6SyTojcwa7KBcOHsz+ZM81fR4akiA79KMVwWSbMKx3I4GZc5fIKCzafr3rU+ZiJPVIP yAUE0igxJZwDciuKPWmJlorTzbd1H0gTJLrpwQhEnGjqXyVu8Av7YCkD/qDs6M2YWJLd Oy7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H3Vh0QtH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f24si16367420ejz.234.2021.05.11.01.43.52; Tue, 11 May 2021 01:44:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H3Vh0QtH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230338AbhEKImh (ORCPT + 99 others); Tue, 11 May 2021 04:42:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbhEKImg (ORCPT ); Tue, 11 May 2021 04:42:36 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7895DC06175F for ; Tue, 11 May 2021 01:41:30 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id g14so21914665edy.6 for ; Tue, 11 May 2021 01:41:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DBeVQ+DbzVOqheKpDE6b/l8xGHNgrrKmzCyeg4MY9MM=; b=H3Vh0QtHbME6isjyak/fqgO1goM8VONv7XU0YXMAPQLdU6UuWv+3oBPI7jY4t2CneN SMOLlmHljBNrs5MNsFp9KmTtTgcZjgAILR6/z0e9S+esC5zunVNqcbjGbksG5i9kfqXY rvoSyY0KFxeVSUWRAMZlfhOOPc5ZgRVGbosfSdzAyX+Al6QmkNZbpVgfycj18NeTncEg I6LAlWymuOFttSd3GMTry/9cWsWU/pTXXw8FKcbou7hoGgzDuzEA7Tdswuy6o3EcNH3T lSDrAwZIAkrCgJd1FkzdDnpFdMBSK/w+j2AjZ6QJkgnqvZi5kcqPY+tEWFr2jycq0CfH 7h6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DBeVQ+DbzVOqheKpDE6b/l8xGHNgrrKmzCyeg4MY9MM=; b=GS2VnEksP49M9qpgxJuMk7gJEJtfXWzwkKPJu7nQB2A7xSaiar1kS2MuB3bTjPqg4u fGk/qCVEre6bwb5pBtmsPNA4yOmk3zXB5QQXPep8xcgAhuaTDTRKapKckKrdOGNtvMZJ BI4Vzz8Ig14Sbl0n20e86KoT4IT490eZAqdPcF1oHXkpsqNWT4bTqbU661w/fn5e87X2 T/8uVd6Vy4bKIObRvKnt7oDzkwO7cQ9pxLFX4mkWN3uTaGqwGRYqDFSy82Ws9ZUAdrIY OuVD34BO+vRzmDXKoqONyzB8RG4pX8pY1ZH4BqDkxZzW4LwKXpEyHVl28gfXRnE7eu+V jQtA== X-Gm-Message-State: AOAM5306pvbL0DbQaU+k4pLRlJNw7bJW74HVQCp5AtsqPl4DPXVJc8/4 5OEIBzh8hjhmIcBU3IAw+bjWuQ== X-Received: by 2002:aa7:c390:: with SMTP id k16mr31251270edq.97.1620722489173; Tue, 11 May 2021 01:41:29 -0700 (PDT) Received: from apalos.home ([94.69.77.156]) by smtp.gmail.com with ESMTPSA id w6sm8263246edc.25.2021.05.11.01.41.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 01:41:28 -0700 (PDT) Date: Tue, 11 May 2021 11:41:23 +0300 From: Ilias Apalodimas To: Shay Agroskin Cc: Jesper Dangaard Brouer , Yunsheng Lin , Matteo Croce , netdev@vger.kernel.org, linux-mm@kvack.org, Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari , "David S. Miller" , Jakub Kicinski , Thomas Petazzoni , Marcin Wojtas , Russell King , Mirko Lindner , Stephen Hemminger , Tariq Toukan , Jesper Dangaard Brouer , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Boris Pismenny , Arnd Bergmann , Andrew Morton , "Peter Zijlstra (Intel)" , Vlastimil Babka , Yu Zhao , Will Deacon , Michel Lespinasse , Fenghua Yu , Roman Gushchin , Hugh Dickins , Peter Xu , Jason Gunthorpe , Guoqing Jiang , Jonathan Lemon , Alexander Lobakin , Cong Wang , wenxu , Kevin Hao , Aleksandr Nogikh , Jakub Sitnicki , Marco Elver , Willem de Bruijn , Miaohe Lin , Guillaume Nault , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, bpf@vger.kernel.org, Matthew Wilcox , Eric Dumazet , David Ahern , Lorenzo Bianconi , Saeed Mahameed , Andrew Lunn , Paolo Abeni Subject: Re: [PATCH net-next v3 0/5] page_pool: recycle buffers Message-ID: References: <9bf7c5b3-c3cf-e669-051f-247aa8df5c5a@huawei.com> <33b02220-cc50-f6b2-c436-f4ec041d6bc4@huawei.com> <75a332fa-74e4-7b7b-553e-3a1a6cb85dff@huawei.com> <20210507121953.59e22aa8@carbon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shay, On Sun, May 09, 2021 at 08:11:35AM +0300, Shay Agroskin wrote: > > Jesper Dangaard Brouer writes: > > > On Fri, 7 May 2021 16:28:30 +0800 > > Yunsheng Lin wrote: > > > > > On 2021/5/7 15:06, Ilias Apalodimas wrote: > > > > On Fri, May 07, 2021 at 11:23:28AM +0800, Yunsheng Lin wrote: >> > > > On 2021/5/6 20:58, Ilias Apalodimas wrote: >>>>>> >>>>> > > ... > > > > > > I think both choices are sane. What I am trying to explain > > > > here, is > > > > regardless of what we choose now, we can change it in the > future > > > without > > > > affecting the API consumers at all. What will change > internally > > > is the way we > > > > lookup the page pool pointer we are trying to recycle. > > > > > > It seems the below API need changing? > > > +static inline void skb_mark_for_recycle(struct sk_buff *skb, struct > > > page *page, > > > + struct xdp_mem_info *mem) > > > > I don't think we need to change this API, to support future memory > > models. Notice that xdp_mem_info have a 'type' member. > > Hi, > Providing that we will (possibly as a future optimization) store the pointer > to the page pool in struct page instead of strcut xdp_mem_info, passing > xdp_mem_info * instead of struct page_pool * would mean that for every > packet we'll need to call > xa = rhashtable_lookup(mem_id_ht, &mem->id, > mem_id_rht_params); > xa->page_pool; > > which might pressure the Dcache to fetch a pointer that might be present > already in cache as part of driver's data-structures. > > I tend to agree with Yunsheng that it makes more sense to adjust the API for > the clear use-case now rather than using xdp_mem_info indirection. It seems > to me like > the page signature provides the same information anyway and allows to > support different memory types. We've switched the patches already. We didn't notice any performance boost by doing so (tested on a machiattobin), but I agree as well. As I explained the only thing that will change if we ever the need the struct xdp_mem_info in struct page is the internal contract between struct page and the recycling function, so let's start clean and see if we ever need that. Cheers /Ilias > > Shay > > > > > Naming in Computer Science is a hard problem ;-). Something that seems > > to confuse a lot of people is the naming of the struct "xdp_mem_info". > > Maybe we should have named it "mem_info" instead or "net_mem_info", as > > it doesn't indicate that the device is running XDP. > > > > I see XDP as the RX-layer before the network stack, that helps drivers > > to support different memory models, also for handling normal packets > > that doesn't get process by XDP, and the drivers doesn't even need to > > support XDP to use the "xdp_mem_info" type. >