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=ham 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 E590CC433B4 for ; Wed, 12 May 2021 14:10:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 396BD613F7 for ; Wed, 12 May 2021 14:10:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 396BD613F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 84A836B006E; Wed, 12 May 2021 10:10:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7FB226B0070; Wed, 12 May 2021 10:10:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6752C6B0072; Wed, 12 May 2021 10:10:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id 4D3A66B006E for ; Wed, 12 May 2021 10:10:01 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 06EA1181AC553 for ; Wed, 12 May 2021 14:10:01 +0000 (UTC) X-FDA: 78132763002.17.00EA002 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by imf09.hostedemail.com (Postfix) with ESMTP id E9C7D60006D5 for ; Wed, 12 May 2021 14:09:48 +0000 (UTC) Received: by mail-yb1-f181.google.com with SMTP id y2so30817925ybq.13 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=UR+ZNqcBBPIommNRXwPONV3oXI6iAgS+VwOyUE5j6dVnLZmAtYhvl4to1VCLl2g2Fk UaSC8z6jf6Tb1jHQfd9Xz5A1xmY2MLUotuzXRjQnxy8yJZjd9QvwXTZQ5qZMLKl/LBzF uz2k4CLiojd3wWK0WNyEUAjvPCQ+c+I2h/iSsB9HVEcaevW6aukWWJ2EoSHfg/EigDWO fpy9rRHiYCcfCMlCERGLdYOjjvZEdw6zEdDxdjqtoJzrvx8SgL4eaGpazGpIBxIS/QhS Hn93HUoKbrPcBByO8PgyJjKeVrsRWnOLwfTe2vXst8WshyE7zNWERACgtj7Kps+/fwhF cSpA== X-Gm-Message-State: AOAM532MW/JASTgUKhE4OfkSDsuAlMW+yj6J4zmXgw4iTC6dyjsChING U4VimrqujUwxwAxRf5IeT6QEr3iEIn3hxuNLrsUlHQ== 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" Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=OV7yj3NQ; spf=pass (imf09.hostedemail.com: domain of edumazet@google.com designates 209.85.219.181 as permitted sender) smtp.mailfrom=edumazet@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E9C7D60006D5 X-Stat-Signature: fd3ph5du97rpo8wqx651wtcucscx53qo Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=mail-yb1-f181.google.com; client-ip=209.85.219.181 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620828588-267239 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 !