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=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 C4296C43460 for ; Wed, 12 May 2021 14:10:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FA7B613F7 for ; Wed, 12 May 2021 14:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbhELOLS (ORCPT ); Wed, 12 May 2021 10:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbhELOLJ (ORCPT ); Wed, 12 May 2021 10:11:09 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FF9DC061574 for ; Wed, 12 May 2021 07:10:00 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id g38so30877564ybi.12 for ; Wed, 12 May 2021 07:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZMqb9pDlPkxQxt7DO3JSQX2FDPEZa9Tg1uyg9iwkb3w=; b=OV7yj3NQQdF7FlfLdQEdonq710miiphHYoEQVNeNZ/aiBaF4QduqoFFT+PXWILPjkX 3lLKurAgxyUo4GVwvrLvBheX30QVU+hvIwSwo0XJOk9i6RCZk2lFYq4cfVn8gyMZcCpj 0FRw/iy/24u2PDncsePYn6l0Rj8jfq5YN5I2LIey4wp0seVSlh2HD5eVdLyVPNxYGaz9 i4ClNAwgNx1rLyC2Au/6hAjL1MYoriYfm4dd70BhFeDJnXG2VxqDvFekWkaKcfju6DmF TOUNPilaGx7Sod94c+dOHZgvHtrzjtHLOlD6Rx6V+8gI/3vJGfZI4gD2mjvfjOheQiCC qqcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZMqb9pDlPkxQxt7DO3JSQX2FDPEZa9Tg1uyg9iwkb3w=; b=OMGDYtCFR6pg6W7RHdepk9AXAIm1yp4QKcPS8VK0SmLoTYIlETezTeygj8wA64oTBr YFhFEpNkLrJrqDbYzSBdMbzOI/VU3athfezizmxwrOM/RZf5JM1/XPNFtUCA8MiAB6sn VPdgkdsZihkuXggUq4VckpCqACGbZmrPgPuWMntHi8/UGAhi28xLagVOhrxI+Ry8JIS6 ds95Q9cLd/Mg8a8TY/7pQWkA/YUlQOtf0qIoaL0lMgYMh7yIUxOWyebxsB/jHwRe19Bw Uuu/GKYA0KrriUZju32vaWM3Z6kwDxzOvXW8tpC+FCzdV+96RKxupmHtSr9GM3LZcwcm +OSQ== X-Gm-Message-State: AOAM5308kb0NLPsazHbj7+2wukO7p5vDrT2YQR4ygMN0w3In5sxFRY5Q mBjySTVmZyqTIkNMOzkmu5lD0mOonAcCUXnUmsYlRQ== X-Google-Smtp-Source: ABdhPJxHpb6RWithEu2vmhMDoaI9be2NUJek9rc1e/+bPZxqSoTLthtREkjsSfQchD2N3oC1udEzZ0LIqBewSkPZWUI= X-Received: by 2002:a25:7ac5:: with SMTP id v188mr27529673ybc.132.1620828599169; Wed, 12 May 2021 07:09:59 -0700 (PDT) MIME-Version: 1.0 References: <20210511133118.15012-1-mcroce@linux.microsoft.com> <20210511133118.15012-3-mcroce@linux.microsoft.com> In-Reply-To: From: Eric Dumazet Date: Wed, 12 May 2021 16:09:47 +0200 Message-ID: Subject: Re: [PATCH net-next v4 2/4] page_pool: Allow drivers to hint on SKB recycling To: Ilias Apalodimas Cc: Eric Dumazet , Matteo Croce , netdev , linux-mm , 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 , Jonathan Lemon , Alexander Lobakin , Cong Wang , wenxu , Kevin Hao , Jakub Sitnicki , Marco Elver , Willem de Bruijn , Miaohe Lin , Yunsheng Lin , Guillaume Nault , LKML , linux-rdma , bpf , Matthew Wilcox , David Ahern , Lorenzo Bianconi , Saeed Mahameed , Andrew Lunn , Paolo Abeni , Sven Auhagen Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 12, 2021 at 11:50 AM Ilias Apalodimas wrote: > > [...] > > > Since we added an extra argument on __skb_frag_unref() to handle > > > recycling, update the current users of the function with that. > > > > This part could be done with a preliminary patch, only adding this > > extra boolean, this would keep the 'complex' patch smaller. > > Sure > > [...] > > > #include > > > #include > > > @@ -645,6 +648,11 @@ static void skb_free_head(struct sk_buff *skb) > > > { > > > unsigned char *head = skb->head; > > > > > > +#if IS_BUILTIN(CONFIG_PAGE_POOL) > > > > Why IS_BUILTIN() ? > > No reason, we'll replace it with an ifdef > > > > > PAGE_POOL is either y or n > > > > IS_ENABLED() would look better, since we use IS_BUILTIN() for the cases where a module might be used. > > > > Or simply #ifdef CONFIG_PAGE_POOL > > > > > + if (skb->pp_recycle && page_pool_return_skb_page(head)) > > > > This probably should be attempted only in the (skb->head_frag) case ? > > I think the extra check makes sense. What do you mean here ? > > > > > Also this patch misses pskb_expand_head() > > I am not sure I am following. Misses what? pskb_expand_head() will either > call skb_release_data() or skb_free_head(), which would either recycle or > unmap the buffer for us (depending on the page refcnt) pskb_expand_head() allocates a new skb->head, from slab. We should clear skb->pp_recycle for consistency of the skb->head_frag clearing we perform there. But then, I now realize you use skb->pp_recycle bit for both skb->head and fragments, and rely on this PP_SIGNATURE thing (I note that patch 1 changelog does not describe why a random page will _not_ have this signature by bad luck) Please document/describe which struct page fields are aliased with page->signature ? Thanks !