Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp405872rdb; Thu, 15 Feb 2024 04:05:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWJq3GijQbXnr4EzNCE9IMdxHz4A6D3JYnPAifNLxn8+NRnN33U4ui/Pj8K3PHBoCStXKPOcC5Xd0O23ctTarZ3T3qR5oeiUrE7EMWzvg== X-Google-Smtp-Source: AGHT+IHQH5kJi3aHS/rBHLQNHztpW+cY+5xsbC9Kv7OKLbGfKcYvx60n4/SSoDClaQvSNy4IBfL2 X-Received: by 2002:a05:6402:287:b0:562:cab:f769 with SMTP id l7-20020a056402028700b005620cabf769mr1319631edv.3.1707998746965; Thu, 15 Feb 2024 04:05:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707998746; cv=pass; d=google.com; s=arc-20160816; b=RDY/lGjSvDAkHm/EulYCADKOKxpJ/5bNwzjrPm0BW3Q4B34UY6AucT8WfeXeJrMCvX q12ZbioOdMRomrKK15YIy+XFokIyQsYppchq6b4Ut2zXiZiiR2XNJnbFVfyEy4pC+f5d fr409JKiBngPNQKp4fBzTyJtxenau7VrcMRNt896Owi/ZXFEhZ4KqDUceg2P1hIadeJw N7OSgxzQbrLKwdNKELP4lUdgc0npui6hA7N3KwRXE8hy+aNUOAhYhvQhLsKG4+BIiyTn jxxbB9+13l6F6x+cNVLqVxhhk8W0pldKpbI3SRCAvGt4aeWFoK1KIF8KX+y9DKo6uVFP 9E4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=CbSKbK1omO7SIzg5N1xXqurgbpEYg8FvdIpUX/tdDrA=; fh=UAHUG7zorIwgAxJz4cZ6mxskDizBzNSS1k8AhUcJW+A=; b=LRm/eGkNDbNrjNApjJUXNFVPkBD7mcQln8lQ4HE5m7/Y1U/7eXXYEEheFph10DsT26 k+wrmfsqZ2KYNSGOEMk6AX8SL6ULNeBxNwtE+GZ7zGFEY9st3YSukjP8DI6FiqdsV4uy 8ZN/DxQGxe7Ng8EbPzkwmUDL5fnFPGCQLPCMCdcuwD/VpqX8KhZHFrGgU6j1GsDUo11h 9RZW3SHj+04O1T4UbDrfVBYjKkye6V1/cezrFMos6X5TLP6Zg/UbS5DxdMMgSajCTXZ4 qjMVhW3vcSCzBj7vsb35eOFQHrX27kV86B0Id1EzJJwK8jWFruwB8gdDRUSNYN6+Jahk ZmaA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YfVT70Xr; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-66859-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66859-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w22-20020aa7dcd6000000b00563be347712si271681edu.277.2024.02.15.04.05.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 04:05:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66859-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YfVT70Xr; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-66859-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66859-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AD0031F22D64 for ; Thu, 15 Feb 2024 12:05:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03D3B12BF18; Thu, 15 Feb 2024 12:05:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YfVT70Xr" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B279769DFE for ; Thu, 15 Feb 2024 12:05:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707998737; cv=none; b=D0Khp3P849rEJHUwoi1XUb4KcFVyN10ZmPuWQLZELjk5XCN3caDoSf/wyfsZ3lryLEft0d6HpGGkRGsitgEgXWb2S36uMdlwoK6BgKTuAnw6JnKr4y+CU+X64NZnvKdpZ5sbFwS/tsjXxknLJ3Y0QYn1gMqDdq6ktYm/G/8/h3I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707998737; c=relaxed/simple; bh=CbSKbK1omO7SIzg5N1xXqurgbpEYg8FvdIpUX/tdDrA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=h9mRKmTMM6vzuZmRDOvON+8pzOT0fIm6TpaOvqoMerPcRIiw9A0Eu0xlC1+1Pn+hE0TWy86T3oMTSkFjG44RmMgCy8K2V7B8MLTbK+NJhEGOsH+FeJtRJ+0zv3V5rXaE9kcBTOVLvzkXn7tCuWjMKimUSjK096DWkhCUTNwsfoE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YfVT70Xr; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707998734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CbSKbK1omO7SIzg5N1xXqurgbpEYg8FvdIpUX/tdDrA=; b=YfVT70XriNgIWzKQ/pG04TzDc6Z5qvgFLVzr4Iha3g4pL0eq6psUWlqIf7x+bC6IEk/xLd LPBeZSSN5Sw/91jC6h4g5d0wboWJBtB369jixeZMKiPOecwUCUVGZAa77LA9TM1IlqD+wX 2zvfD/WcwSu/i7c+Z2Kld6Z/F0qzOdQ= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-44-wxNq_PjXMe-Dgytucg3RkQ-1; Thu, 15 Feb 2024 07:05:33 -0500 X-MC-Unique: wxNq_PjXMe-Dgytucg3RkQ-1 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-558b84a7eeeso728082a12.0 for ; Thu, 15 Feb 2024 04:05:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707998732; x=1708603532; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CbSKbK1omO7SIzg5N1xXqurgbpEYg8FvdIpUX/tdDrA=; b=T1hZ502EX+MvrvgwADoaSkBLjh+zjFwGdSl5GQp7Oz39w5iBc6LF/hdoooujzrqjks TKZM05URQbg9bG+r5Szr3GWLThEuZOEnyXJ7ZKod2BXxjjwU2/zLymYPTG6wAVijJ2Ba FafcM3eyLIDgoEIoIPvdznBbGWy+ylTsRyLH4qSyVV89LPHinWL7brE1Ij1h+8YauRpV 0CkDsuUtp3/LptUgL+rWngBtVQ0V5He6Ml3HM9yzA9vfYAw0Iv1asKrPANbFYXR1Zvoc J+qVNM2yciTME7miqF/5B54Oq2Sh7T8wDr6nmA1h+O/N0kd9mYGEZxmrM8WdfROFeZqA NieA== X-Forwarded-Encrypted: i=1; AJvYcCUg+M96rw3nXFbrgfGEQi/gtAKRtvGuoHu2a2fBCfCXmkdfrcnstnDyQQQgg/YBwSI5yAT2x/Ozu2F2JCjdTG6Fhe6YJe50wL8GvA6c X-Gm-Message-State: AOJu0YwwRxKTZLCMUUY25S6Gu99IyOfR8JbJFDrA9rHhHc2N1Tklyx6D A0ewZUtyWDERuA8Z4+hN6MjsLZfXW1DshvUjPznuzD80SaMR5NYWScPFVJHuAzeqX2cFYj92ss3 kRBRLoTPPvyYZRy+rBXp8MXiWHFVhnacT13XBUO02OAFKYfsVdSD30UzVav9DkA== X-Received: by 2002:a17:906:80d7:b0:a3d:a4bf:8fd3 with SMTP id a23-20020a17090680d700b00a3da4bf8fd3mr628229ejx.49.1707998731987; Thu, 15 Feb 2024 04:05:31 -0800 (PST) X-Received: by 2002:a17:906:80d7:b0:a3d:a4bf:8fd3 with SMTP id a23-20020a17090680d700b00a3da4bf8fd3mr628214ejx.49.1707998731672; Thu, 15 Feb 2024 04:05:31 -0800 (PST) Received: from alrua-x1.borgediget.toke.dk ([2a0c:4d80:42:443::2]) by smtp.gmail.com with ESMTPSA id s26-20020a170906a19a00b00a3d636e412bsm474883ejy.123.2024.02.15.04.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 04:05:31 -0800 (PST) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id EF30510F59A0; Thu, 15 Feb 2024 13:05:30 +0100 (CET) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Alexander Lobakin , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Lobakin , Lorenzo Bianconi , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] page_pool: disable direct recycling based on pool->cpuid on destroy In-Reply-To: <20240215113905.96817-1-aleksander.lobakin@intel.com> References: <20240215113905.96817-1-aleksander.lobakin@intel.com> X-Clacks-Overhead: GNU Terry Pratchett Date: Thu, 15 Feb 2024 13:05:30 +0100 Message-ID: <87v86qc4qd.fsf@toke.dk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Alexander Lobakin writes: > Now that direct recycling is performed basing on pool->cpuid when set, > memory leaks are possible: > > 1. A pool is destroyed. > 2. Alloc cache is emptied (it's done only once). > 3. pool->cpuid is still set. > 4. napi_pp_put_page() does direct recycling basing on pool->cpuid. > 5. Now alloc cache is not empty, but it won't ever be freed. Did you actually manage to trigger this? pool->cpuid is only set for the system page pool instance which is never destroyed; so this seems a very theoretical concern? I guess we could still do this in case we find other uses for setting the cpuid; I don't think the addition of the READ_ONCE() will have any measurable overhead on the common arches? -Toke