From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F34B3C433B4 for ; Mon, 17 May 2021 11:35:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D295B610CB for ; Mon, 17 May 2021 11:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236811AbhEQLhI (ORCPT ); Mon, 17 May 2021 07:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236809AbhEQLhI (ORCPT ); Mon, 17 May 2021 07:37:08 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DCE6C06175F for ; Mon, 17 May 2021 04:35:51 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id k10so8677620ejj.8 for ; Mon, 17 May 2021 04:35:51 -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=cpVCz5J0mualmBJL14dU/kCHM8m4z1AkfD48q7fb54Y=; b=j7UvTXiSILRPux9PGsOIlTxwHEXL4df2qspCBdJq2w8fVwIVveJzi/6katDaWZo4kb WN+z1G8hvYNmldIuH4Fl5+DrK+e+1lb+3S9aIv1EdWQOae9rn5VmJ1jHd6S+gSrJfvwV Lk7kMEZB1sfEEzgaNAxgb0yoPriBMzUXWa32eDVvkQexwx6BI3xnQVOBuX8KSWVX+m0e rB4bWR23P0G5dAzeAsBAjeIOYEK3DoYX98NiaEhZXc1+THb4z8mOEGv2788ult9f2SZT 0gT7uwxcvFZy+qZYMvUCpCCUdPYZYRCCQQr0DDqYtVrHDkKGg1j/KWB0P0iwo9wtF/WT 3cwg== 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=cpVCz5J0mualmBJL14dU/kCHM8m4z1AkfD48q7fb54Y=; b=cAfky13HqQ7Ip0tiUf6nIT78FbgUdV0c770gkDcEXXJTBkInZmr1+X+SNDIL5ciYcl r2z743bO7ZdbeejOsyqK34UJoN5kSmR2tUrt/aBT3Ec5ydvWgQDqTdXVkB0kf1hiXvYY qIl983JlPCPCSvlIUYtWNvp/WehvuwU5113gDXzOnxD4wPGTDLLQitxUuuXM9pdukgVr mTcdHFyAak+ZgxidEMEmQ5ZYAt595tP3j2TatM3zarEsl/CVaqV0uhECqfu/d1XOmH4O FcCfzbdGBgqsBs3HdaQPBG/3XRAL1dscOgSzwuNFJ2/h4tXYcG7zoVNMqIMo59cvBmC4 lzKw== X-Gm-Message-State: AOAM530UgThQeFamBedgwffzOVZO71l8/rAe6ITJ17SiONF8Rw9DF00O vnA0AP4AOy/n6Rq76hFZZ3FwQw== X-Google-Smtp-Source: ABdhPJzt2r6RHjtKUUNYBd1PR/7rdCUkb6ACw8GomMcdp8eOm4/+GQQxMTKlfPAItXeOe1oy5amyFg== X-Received: by 2002:a17:907:20a8:: with SMTP id pw8mr11169946ejb.256.1621251350130; Mon, 17 May 2021 04:35:50 -0700 (PDT) Received: from enceladus ([94.69.77.156]) by smtp.gmail.com with ESMTPSA id b19sm10631737edd.66.2021.05.17.04.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 04:35:49 -0700 (PDT) Date: Mon, 17 May 2021 14:35:44 +0300 From: Ilias Apalodimas To: Yunsheng Lin Cc: 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 , Fenghua Yu , Roman Gushchin , Hugh Dickins , Peter Xu , Jason Gunthorpe , Jonathan Lemon , Alexander Lobakin , Cong Wang , wenxu , Kevin Hao , 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 , Sven Auhagen Subject: Re: [PATCH net-next v5 3/5] page_pool: Allow drivers to hint on SKB recycling Message-ID: References: <20210513165846.23722-4-mcroce@linux.microsoft.com> <798d6dad-7950-91b2-46a5-3535f44df4e2@huawei.com> <212498cf-376b-2dac-e1cd-12c7cc7910c6@huawei.com> <074b0d1d-9531-57f3-8e0e-a447387478d1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <074b0d1d-9531-57f3-8e0e-a447387478d1@huawei.com> Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Mon, May 17, 2021 at 07:10:09PM +0800, Yunsheng Lin wrote: > On 2021/5/17 17:36, Ilias Apalodimas wrote: > >> > >> Even if when skb->pp_recycle is 1, pages allocated from page allocator directly > >> or page pool are both supported, so it seems page->signature need to be reliable > >> to indicate a page is indeed owned by a page pool, which means the skb->pp_recycle > >> is used mainly to short cut the code path for skb->pp_recycle is 0 case, so that > >> the page->signature does not need checking? > > > > Yes, the idea for the recycling bit, is that you don't have to fetch the page > > in cache do do more processing (since freeing is asynchronous and we > > can't have any guarantees on what the cache will have at that point). So we > > are trying to affect the existing release path a less as possible. However it's > > that new skb bit that triggers the whole path. > > > > What you propose could still be doable though. As you said we can add the > > page pointer to struct page when we allocate a page_pool page and never > > reset it when we recycle the buffer. But I don't think there will be any > > performance impact whatsoever. So I prefer the 'visible' approach, at least for > > setting and unsetting the page_pool ptr every time the page is recycled may > cause a cache bouncing problem when rx cleaning and skb releasing is not > happening on the same cpu. In our case since the skb is asynchronous and not protected by a NAPI context, the buffer wont end up in the 'fast' page pool cache. So we'll recycle by calling page_pool_recycle_in_ring() not page_pool_recycle_in_cache(). Which means that the page you recycled will be re-filled later, in batches, when page_pool_refill_alloc_cache() is called to refill the fast cache. I am not i saying it might not happen, but I don't really know if it's going to make a difference or not. So I just really prefer taking this as is and perhaps later, when 40/100gbit drivers start using it we can justify the optimization (along with supporting the split page model). Thanks /Ilias > > > the first iteration. > > > > Thanks > > /Ilias > > > > > > . > > >