Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1042543pxb; Tue, 19 Oct 2021 19:20:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwo24FXVHeTd21e7wv/dz9FYaXovDAdfgQEIa1YOi/nLCCZ+xmOZbc36pxzo4OeACunzkqe X-Received: by 2002:a05:6402:402:: with SMTP id q2mr39142882edv.248.1634696424123; Tue, 19 Oct 2021 19:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634696424; cv=none; d=google.com; s=arc-20160816; b=ciWcdgDU/SuWK/We5w5I6K62DBnAf2HD1em8uGqMwznoyQZNoo0tLJZ9dD/sPtmrOn S9liNrhNN/C6xXdCVSzc/D6eJ87P+Kw0z2l3cO8Y/WoOweqsgUOMNxn8a/+Vu547G4m4 4jxVvb67fGFMvQciOTg2Bz3G71HkcCF2XmuJlikQYVVGR0uHhOyNC1LNdSyJiH8n99Jm fg/kqWGxDur4Ts3YyS55794vxueFMkuS7MNluvn1y+HXATwbdesS7fIbc2pVNqX8yjyZ VI710hf+pl9gLpQhC32kpC0n2m2J15/duoHDyjxUSXnFCiMCBjcseht26CF2TG5DpH43 azRQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=D74GYl4Q75+oXj/aMCjO7YTPXeKQjd+IcbtXAGLf308=; b=k1LK9WGe+ktsO3Go+CZSttJ51xNp4QcTCZ9QsE3FDro4byKHo5A/hFs7kJLDehBgOI iDfQ9smH9gEUudC8wfOmDI9gO3IxXV0tyCGq/sIzKsTeuwu7fWGeWpJbbkGRjPEBbtnM tMAZVkRtP+1ZJCKX9+n8CXYsZR3F48e6M/fzRZ2N2PQ/Ewk0OjiJG9yL/2uKwzJMrpS4 jxfpHfmVd/HHh9jkRnnye50V+R6TT7Jwa0pQnf+wr7cFZHKqoI8BY0gGiOMFhE/248uK IfnWX/XkXWOar9dLULihZgrYthjMDrHTLIvTWNycPxgPxjf2PuSdBRvVYO6u1EWO5Sx4 ExPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Bs2r5YFJ; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ka26si985459ejc.280.2021.10.19.19.19.59; Tue, 19 Oct 2021 19:20:24 -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=@redhat.com header.s=mimecast20190719 header.b=Bs2r5YFJ; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbhJTCUa (ORCPT + 99 others); Tue, 19 Oct 2021 22:20:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54115 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhJTCU1 (ORCPT ); Tue, 19 Oct 2021 22:20:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634696293; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D74GYl4Q75+oXj/aMCjO7YTPXeKQjd+IcbtXAGLf308=; b=Bs2r5YFJXMOX61pXNAEqEnnG1ilWnSguIV8DwERM8Ui4u6QEm0fbH07Fk03l2H7QT7Nz/L IwS8bh7OOFq4SF9eWN7qw3ae07Y1g4t35BUABs2g3RRgp1YRhz3dGLJCsb2x52krb6UV5l b/s2yWCaciS625SLcSsN74CSkvj0kSg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151-8Kxz5JYxMzONNvmCRHlvSQ-1; Tue, 19 Oct 2021 22:18:10 -0400 X-MC-Unique: 8Kxz5JYxMzONNvmCRHlvSQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5F264108088A; Wed, 20 Oct 2021 02:18:07 +0000 (UTC) Received: from T590 (ovpn-8-20.pek2.redhat.com [10.72.8.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22A5D103BAC7; Wed, 20 Oct 2021 02:17:46 +0000 (UTC) Date: Wed, 20 Oct 2021 10:17:41 +0800 From: Ming Lei To: Michal =?iso-8859-1?Q?Koutn=FD?= Cc: Quanyang Wang , 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 19, 2021 at 07:10:26PM +0200, Michal Koutn? wrote: > 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. If only precpu_ref data is leaked, it is fine to add "Fixes: 2b0d3d3e4fcf", I thought cgroup_bpf_release() needs to release more for root cgroup, but looks not true. Thanks, Ming