Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5868308pxv; Wed, 7 Jul 2021 13:42:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDefbcrY9TpihHQzZ3JKxrXHasvUnEKAIu97n1YybGWM/s1tN5/YsMETfrmHxU6EM/qWVH X-Received: by 2002:a05:6e02:1091:: with SMTP id r17mr4609571ilj.160.1625690548062; Wed, 07 Jul 2021 13:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625690548; cv=none; d=google.com; s=arc-20160816; b=jLtyeAex8p3DjvljFxFUWNwN1rwI7PEXNJVAXe7QPU+ZQi0+7X9BDaD3LKlk2optEL Qb8ugYYCQQW/e/1viY10PzeqifS66KcGA7Np53RzwtIkBaWM5vNCtaH346kDbShCmQJl lFpYtUo6qXAM4kF5nTvddXIfLXHl37vKt7Tvx9Ty642kvjfSmavVpWvkk+2PSC01cYfq S2BywFt8NsbLF3Qa03Srzz9gIDlIb24cZrECukoCh1lxpBIqvlwTLkNanH7JF9SvIxWP LrDzwf8oGm+xuVV187m/UBxz3q2qsCoySiSYtFYm5IrYXQ9jI974ypTnrycSSiVqwq+w q66Q== 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=gEyVsUHVabbCcurt1vqr+nKmr7tjD0Zle1ugJOsxNk8=; b=SEyVPzrntTJGNd/Qf1WOa6GlDiqDnQN1xwxa0NSi/38LSN3AF4pmaFAA+ZQqPqpAmx 3z/p48jwQYykUM9aIZPz/I9USIM6POfZ/Y9WLdnNzL9R3z7IZP7rw1odQMJlkSuSmkUm GrG/wkm2twGtQMYM3/6PKsSv69v8ZjmS58GQmwleJsm1CHFh6BoVe9O9I0KIsZnjcbwf Ct2gGSlM42YpMgEmyGxHBLjelzue74pT/PgO5Wa9PWHvn6d2/8R+mqHOveStM+JPUDpj 9beZk004kHsbR0ICUMUD96x3kWUop+ze1UEzJZ/fwf+0JMwGWe5JJcKNBGzI+bQV9gb3 eS6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uQahgciw; 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 j8si100798ilu.69.2021.07.07.13.42.15; Wed, 07 Jul 2021 13:42:28 -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=uQahgciw; 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 S230418AbhGGTFz (ORCPT + 99 others); Wed, 7 Jul 2021 15:05:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230390AbhGGTFz (ORCPT ); Wed, 7 Jul 2021 15:05:55 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C7D9C061760 for ; Wed, 7 Jul 2021 12:03:14 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id d12so3667179wre.13 for ; Wed, 07 Jul 2021 12:03:14 -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=gEyVsUHVabbCcurt1vqr+nKmr7tjD0Zle1ugJOsxNk8=; b=uQahgciwZnRHDS26dth70zA8+WBNEzYXuwzc5GVRJBSrJhp07jCDpwzSWiUiptb2xj 7cdrZCMoJaRDHDN5jl+6M3lZynZVuiOBQkMz4ZFxna6AQ2fmmt3NoX2BtkPno285C5Qw 02Rsz/SXQFpkQsz5wvsk6J2s8UlXFa3qb6dsebpiSGYpSXMfyI0NScRUnMx3wA5+3Wlc CP9d3VQn8Zie43uo08Vg+N4sjAXt4UjVIUwqUSt0L6kfkiHBqSF9XtEn/ueEmIsCh9Xi 8XFnLAamPMICjrEtTWKoHF0iJRdn1t7BJmVvRBDpJW01CQqYM8C6/WMnpEUZ+9E3RpOY fBYw== 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=gEyVsUHVabbCcurt1vqr+nKmr7tjD0Zle1ugJOsxNk8=; b=OypUGGwx+iZv7CcERiFQZBmmvSner47fIl8xtEcTjpoVPqqsK0dVpUU1fqGNBdMYaB YsFxOTZ77UMS24NS5ocZyDPwC8r63q0RY/MrbxpknSFhOtyjJhGmtZd4wVy7QF5K0J44 9yN8hfxpF2UQKF2g6We4kw3zNaMqTeacnyVWn1zQj8VmzQNw/225xl6QbLfsoKMoV8U2 NuwRBAmlVJD2EX2/m2pgvLyd7+lBU+gulWZzDkyn8hT0FO/Cv2Z7Vl4g7mi0Nub8njC/ c6uNadEbMgozoh6Q7rcCV1Ni5JTtsSQa2zU3caxpJsAaxSHQRrAs76Gn3oOptsT+44nC hCJA== X-Gm-Message-State: AOAM530tXQb8mayTmMQ1GdSbV1y57fulbD8Tv2sTGUMZ5juDcu8bM0BM rtVbArwA7vyIH3WI4owVlGDvBQ== X-Received: by 2002:a5d:61d1:: with SMTP id q17mr30439214wrv.162.1625684592806; Wed, 07 Jul 2021 12:03:12 -0700 (PDT) Received: from enceladus (ppp-94-66-242-227.home.otenet.gr. [94.66.242.227]) by smtp.gmail.com with ESMTPSA id c12sm23742825wrr.90.2021.07.07.12.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 12:03:12 -0700 (PDT) Date: Wed, 7 Jul 2021 22:03:08 +0300 From: Ilias Apalodimas To: Alexander Duyck Cc: Yunsheng Lin , David Miller , Jakub Kicinski , linuxarm@openeuler.org, yisen.zhuang@huawei.com, Salil Mehta , thomas.petazzoni@bootlin.com, Marcin Wojtas , Russell King - ARM Linux , hawk@kernel.org, Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrew Morton , Peter Zijlstra , Will Deacon , Matthew Wilcox , Vlastimil Babka , fenghua.yu@intel.com, guro@fb.com, peterx@redhat.com, Feng Tang , Jason Gunthorpe , mcroce@microsoft.com, Hugh Dickins , Jonathan Lemon , Alexander Lobakin , Willem de Bruijn , wenxu@ucloud.cn, cong.wang@bytedance.com, Kevin Hao , nogikh@google.com, Marco Elver , Netdev , LKML , bpf Subject: Re: [PATCH net-next RFC 1/2] page_pool: add page recycling support based on elevated refcnt Message-ID: References: <1625044676-12441-1-git-send-email-linyunsheng@huawei.com> <1625044676-12441-2-git-send-email-linyunsheng@huawei.com> <29403911-bc26-dd86-83b8-da3c1784d087@huawei.com> 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, Alexander > > > > Thanks for detailed reviewing. > > Likewise! I'll have a look on the entire conversation in a few days... > > > > > > So this isn't going to work with the current recycling logic. The > > > expectation there is that we can safely unmap the entire page as soon > > > as the reference count is greater than 1. > > > > Yes, the expectation is changed to we can always recycle the page > > when the last user has dropped the refcnt that has given to it when > > the page is not pfmemalloced. > > > > The above expectation is based on that the last user will always > > call page_pool_put_full_page() in order to do the recycling or do > > the resource cleanup(dma unmaping..etc). > > > > As the skb_free_head() and skb_release_data() have both checked the > > skb->pp_recycle to call the page_pool_put_full_page() if needed, I > > think we are safe for most case, the one case I am not so sure above > > is the rx zero copy, which seems to also bump up the refcnt before > > mapping the page to user space, we might need to ensure rx zero copy > > is not the last user of the page or if it is the last user, make sure > > it calls page_pool_put_full_page() too. > > Yes, but the skb->pp_recycle value is per skb, not per page. So my > concern is that carrying around that value can be problematic as there > are a number of possible cases where the pages might be > unintentionally recycled. All it would take is for a packet to get > cloned a few times and then somebody starts using pskb_expand_head and > you would have multiple cases, possibly simultaneously, of entities > trying to free the page. I just worry it opens us up to a number of > possible races. Maybe I missde something, but I thought the cloned SKBs would never trigger the recycling path, since they are protected by the atomic dataref check in skb_release_data(). What am I missing? [...] Thanks /Ilias