Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4512434pxj; Wed, 12 May 2021 07:14:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyd08RVnjwAfiuLMkxlof/xYcgYhzAwXFFdTTA466BJA49laDbhTkWZmc3gx9lCJww4d8gQ X-Received: by 2002:a05:651c:485:: with SMTP id s5mr29918203ljc.364.1620828865637; Wed, 12 May 2021 07:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620828865; cv=none; d=google.com; s=arc-20160816; b=z9qHluaygKTYEF0/cEHHYAojAdJaOcvyTMlJpNElO82fyrFJS01C+QVz7/2jpkiWe6 ZfOe3fzlRzGeYkGqv1Gutuus195b4Vt0s2cPAklmcbe94E5ibEAUArK4z/HlBKYqi9QY wfbDnX6k5plx1uem2CJ9upFcNmIkKyJCfH4jJ/Ow8tWKMzNYyvcCymkEjyZVeed8hDb7 +yBe3hCrFkBiy6AQlJxC9qUi8ojdjVIOaj+GD2GPPSYpDe7BVHyjgxVNafi7lcTjL+OF 1xEaqKazRLcaxq5Kjji6sDlPsbS0hUqq2WYksZjfFEVt6kgfSc5C4sWjOZ6Mn2+uQXKv tJ2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ZMqb9pDlPkxQxt7DO3JSQX2FDPEZa9Tg1uyg9iwkb3w=; b=KFZ2nTn9mwroYuN+xLmbaoHPIsnjqErzIEh304zGezhf4PVZQC31RO1L/ZtOPrQiqY Q8g+4EI/c2frq/+7lixeegwUw1sYVqctoTV1RFXogOlDaGKBT93bAkRfx2yLcQRbDpu2 UswgeKsDv4K4KDElhNgy0wwDzjDcHYJhCcZXDtgfJ9YMiirbir0LZVOysI9SkSImSd21 ueLLHmpTdiGImaY/cDnx7YkGfTJuGPi4VCRGPnUYr+Ounjj45+0ghyevLIkewzmv6ZW1 H2n1N3XFORLlyVBqL/S05isb4EaQL9/6FPYsArabLxKuhPRUs3e+SxKqLD8l5uhlNs0n 8ttA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OV7yj3NQ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u28si431lfm.546.2021.05.12.07.13.54; Wed, 12 May 2021 07:14:25 -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=@google.com header.s=20161025 header.b=OV7yj3NQ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231162AbhELOLL (ORCPT + 99 others); Wed, 12 May 2021 10:11:11 -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-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 !