Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp657050pxb; Tue, 19 Oct 2021 10:12:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtP64Im5ecsW508CiTvdoYvztqkDrF3iarv5R21gckSQvpbkz7vL4hayk1WHAxXN+c7ayk X-Received: by 2002:a17:90b:33c7:: with SMTP id lk7mr1164894pjb.172.1634663570644; Tue, 19 Oct 2021 10:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634663570; cv=none; d=google.com; s=arc-20160816; b=bnqS7hOOjakIznBohm6aMA1m7ODrq1tYG1iKQtgdrIPfrYPcVYKdoITvcatUqmf/dW rY6NV7KsbstOUKyuYap3339ehFvG4sZTnaobXcdP0MbRmH/77Nw6BSPRb20ZEnvcchNL jGe04ey6dhvSISgsugeOLoI2R9gF6gMopeMWotIAByJdS1NGwlQDa9ntHc0IJabfSZsz k5U/mNjqnX14D/OJRO8yRD6PSgjf4WnySeyO4G8OdH6mAKlp4QXlQJj+vfFr703XOe9L 3TqowWnpoh7P3VZqwsfdp6fsuEBExs1xMfUwU7VGLuGTX5Fnv6sS+Ffqwfxmg6kwmahl AtuQ== 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=1eyKSX2/7swyCKXn7z9fVjzybvXll+tbtLpZFqDx1m8=; b=xTLbDeIWwjoyXBRgBORSkp94A9SAgFS42w/RUKw8NJNW6QLqOUr9wBVIVLuKZGBl7S XErvij9d8GFrQiTJ8dvwovD1H8BSmxs3PdZwY0FCU6nMQKUNyFAB9nlpHXaFFh0L3Wdm 3DU/caOr5VFMNaBzMmsqy9RAdP3JkB7O8JMP8WiO+qpxPOajK8lccxaiFyga+Uy+Pr3K GQE5kESHZZMRteTGFjnnKqShe9RBZh3b665lxCEph5I0SYr/g8edegFhr5Sf5cS5ILmq LWbtqA+rIkUcA9G0gNu9/QhpXguj7007XpZgj/kUAeN1yMCMK6dybWwY4QbZZS/9xcwa 1DLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="RVz/tL02"; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hg20si4071453pjb.11.2021.10.19.10.12.28; Tue, 19 Oct 2021 10:12:50 -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=@suse.com header.s=susede1 header.b="RVz/tL02"; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233460AbhJSRMn (ORCPT + 99 others); Tue, 19 Oct 2021 13:12:43 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:36142 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbhJSRMm (ORCPT ); Tue, 19 Oct 2021 13:12:42 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 65A2E21A76; Tue, 19 Oct 2021 17:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1634663428; h=from:from:reply-to: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=1eyKSX2/7swyCKXn7z9fVjzybvXll+tbtLpZFqDx1m8=; b=RVz/tL02sPQdjtNeumX2ZM+VtIFyIcTOEASFvv6I0/FVlHvZ4o9I/0RJ7QO2xcZDmai6xU 4h/KSMw/yrIULI7jwk8EkRvwcpYQFzka8UE4eirJd7G1eClI5pV5rYNy+uIttiWykEFB+n aMD35+up03LH+YwZPGz6j/iIN4qa1fE= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F310A13E8E; Tue, 19 Oct 2021 17:10:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YBKFOQP8bmGfIgAAMHmgww (envelope-from ); Tue, 19 Oct 2021 17:10:27 +0000 Date: Tue, 19 Oct 2021 19:10:26 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Quanyang Wang Cc: Ming Lei , Tejun Heo , Zefan Li , Johannes Weiner , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Jens Axboe , Roman Gushchin , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [V2][PATCH] cgroup: fix memory leak caused by missing cgroup_bpf_offline Message-ID: References: <20211018075623.26884-1-quanyang.wang@windriver.com> <8fdcaded-474e-139b-a9bc-5ab6f91fbd4f@windriver.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. On Tue, Oct 19, 2021 at 06:41:14PM +0800, Quanyang Wang wrote: > So I add 2 "Fixes tags" here to indicate that 2 commits introduce two > different issues. AFAIU, both the changes are needed to cause the leak, a single patch alone won't cause the issue. Is that correct? (Perhaps not as I realize, see below.) But on second thought, the problem is the missing percpu_ref_exit() in the (root) cgroup release path and percpu counter would allocate the percpu_count_ptr anyway, so 4bfc0bb2c60e is only making the leak more visible. Is this correct? I agree the commit 2b0d3d3e4fcf ("percpu_ref: reduce memory footprint of percpu_ref in fast path") alone did nothing wrong. [On a related (but independent) note, there seems to be an optimization opportunity in not dealing with cgroup_bpf at all on the non-default hierarchies.] Regards, Michal