Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1146675pxb; Tue, 19 Oct 2021 22:23:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw40vl5CWWaLYa4xVVekgYsuV/y/eKLuuy80A5A7pHMbDqBnPqGJnAbRsXqadT8DO26aQ1F X-Received: by 2002:a17:90a:de0d:: with SMTP id m13mr5090277pjv.85.1634707436905; Tue, 19 Oct 2021 22:23:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1634707436; cv=pass; d=google.com; s=arc-20160816; b=GvFrpg4DZdgSitv34CWX7E69noMkz8WuiIYzW7QxActUzp8utVzF/B0YvmxvirsCZ/ 5H1EsNjppIYJo1Y4KsBYddPThfb0fKygdLp64QWE7JiPS+Uav7S+rMHEAGVzBNcm3uyn MNS4d9tjlIPCNBle8arNoZYK/xKhS8+iApV7BHxYIw0I/BuKs3fN0VBMtWtMZ6YMo2XP 1nIdnB76MISUTdlqF95my/mraLnPZjo7/g6EjY63L0wQi3D6VK6/EK3sq7bFO3DqY367 iMG5/KBpLiKcPW4igXf1H1bUBqViK4nLyaZd3w4cNT71nsgsHQNGjaKF3A62WMF3HoGo vUiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=M3zj3HR38ju4gp1SZHrNW/BA6M77hV0CkGIcQsrcsK0=; b=wHdh+Fap7LdPi23Y3BdhcGgNHWwLIsAADhdbEA0JrlHdG2zNSmGYNyAku9m/g/4QP/ RLZTb69KcCT7NsrFqj3/Sa4Dd9sTv+OwoTDuIoob5MvvB/4Y9Yd8pzgrf5WH+xOxPAl8 NfqfdC46pAmzd4rzmVw76VyQ7avuC2XY7jJ/4DmcbeAdOxNTfvFFjb+SBqxRIXFvJbOB iXTmxRNcTJO2gGoSmiJSNknpPjqxmLfIwgagDh+WzHItn23/F4KU+fmPSLqKCUXj92WZ K7bMIXhntviM0+BRrwnljgyDBk5gLXOYuZCBRAASUoJ5Z/faTkJ/Kpi0nqn72IXSfSMm i0Eg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=crGWu1hu; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); 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=windriver.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u20si2151218pfk.226.2021.10.19.22.23.43; Tue, 19 Oct 2021 22:23:56 -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=@windriver.com header.s=PPS06212021 header.b=crGWu1hu; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); 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=windriver.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230049AbhJTFY6 (ORCPT + 99 others); Wed, 20 Oct 2021 01:24:58 -0400 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]:40436 "EHLO mx0b-0064b401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230005AbhJTFY5 (ORCPT ); Wed, 20 Oct 2021 01:24:57 -0400 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19K5IgSI017313; Wed, 20 Oct 2021 05:22:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=PPS06212021; bh=M3zj3HR38ju4gp1SZHrNW/BA6M77hV0CkGIcQsrcsK0=; b=crGWu1huM+TIIna967vieg/UKP8sGSVESCR3YhUBXa3FYNlpHcQkTohcggmHzoMgisrt BDo9k5kHMlnrMdT237+b69G9trrewnowx5GbJDefq1qPOoPVBXenf0WgQBslSJOq004m xbVJtUPvNg8ISxYEQcTVt6Oty2WivXABfu/7c6eEFkQMRMJxMkIxA9t6zgsoyRcZoHAB RgtE/txvhI3kRZVTetucI2FH6DDF5y5Js81cTcc0x7kzPkVDyuvbEuCj7Q3IHogRi7pD t+qUWTJEdngwGnedgTr4z4e64aQkq8713KbmmrUvd+OrFciUV0MLUTyXnkDc6nky9M0d RQ== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by mx0a-0064b401.pphosted.com with ESMTP id 3bt6pg874p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Oct 2021 05:22:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XlJxjXDggoOeYSjSXblPsAW2NJWbMuDwFMhWN8P04u8AXsfeItCTEwkE/uqqauFo69XiUihuhwNQ2cYKA6YBqxVl3PYGrNKiuwZ+vMYew1EurRpXN1satJU4kxoOklAg0uyP+Gff2DBPvAdY5ZPGivnqjb9vFEqrwV4doelsSLhhtMljiCXtvbQ3gyooT/SAIRB45e8v8M5bQiE9p3dWGmEYcR5UJfnyCqGwAZ1ZD77dy4VlziG7OOlw8feJifq4XbocGyjAa6hVbNhr61norf0lyAjWDMN31OlF24vqaEEjUC07vCyMgeiQAiMISIXwStczW5EpBBQv12s/5YmUiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=M3zj3HR38ju4gp1SZHrNW/BA6M77hV0CkGIcQsrcsK0=; b=U/vIYeK1kpAwXuUw7GMGdTPy63mqZzMGkHKlmNlrPzaC7FX1bVodB2e8lVrh8ZoF8EtsG14ZNIDO+5pE7gcL+Zon2aRCBUCiW4rU8b8o4bP554e9l6e0/xJy18fsQcQbDXo5odekQPIES+BYi0h17WsnqsQ998ZUJ3VyvvuOwVYIq1OVfAXJJJP0juAUPj6ehGbodbohe0DWe2+4zEdgkmaG0FLqSTkof/v9BDyg7Q9uTMRFLqjO33iVUTZG7gkuTezVE0CPX2fLWn6iZJllhG0XKxFCXIcu2oYEn2ulSFjUjEYleLfeCw69VSUU5X7FtXPll0clJbg+0J/f9e0tVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=windriver.com; Received: from PH7PR11MB5819.namprd11.prod.outlook.com (2603:10b6:510:13b::9) by PH0PR11MB4854.namprd11.prod.outlook.com (2603:10b6:510:35::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15; Wed, 20 Oct 2021 05:22:15 +0000 Received: from PH7PR11MB5819.namprd11.prod.outlook.com ([fe80::3508:ff4c:362d:579c]) by PH7PR11MB5819.namprd11.prod.outlook.com ([fe80::3508:ff4c:362d:579c%6]) with mapi id 15.20.4608.018; Wed, 20 Oct 2021 05:22:15 +0000 Subject: Re: [V2][PATCH] cgroup: fix memory leak caused by missing cgroup_bpf_offline To: Ming Lei , =?UTF-8?Q?Michal_Koutn=c3=bd?= Cc: 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 References: <20211018075623.26884-1-quanyang.wang@windriver.com> <8fdcaded-474e-139b-a9bc-5ab6f91fbd4f@windriver.com> From: Quanyang Wang Message-ID: <7a21a20d-eb12-e491-4e69-4e043b3b6d8d@windriver.com> Date: Wed, 20 Oct 2021 13:22:06 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: HK2PR06CA0006.apcprd06.prod.outlook.com (2603:1096:202:2e::18) To PH7PR11MB5819.namprd11.prod.outlook.com (2603:10b6:510:13b::9) MIME-Version: 1.0 Received: from [128.224.162.199] (60.247.85.82) by HK2PR06CA0006.apcprd06.prod.outlook.com (2603:1096:202:2e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.18 via Frontend Transport; Wed, 20 Oct 2021 05:22:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b9413d2d-568f-4167-69fe-08d9938993da X-MS-TrafficTypeDiagnostic: PH0PR11MB4854: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I+Q3uuIp9PKA5incH1pEWGHR80wZFEkHvhK644d39Uo9E+3lU+WxCop0YAj2m+pHCWwDjtI2WSFByrOjnVxBDpya/lVkF2ObJqtTKbESCl7iPh3AKutxCtUbRRbDlXJhYgLOhLzsFa6aO2Vg/zT686GCRjxVIGNdsMHBbpddoJf1Nh2uYn31nB1T2ahLZcZrXYHSA0F5AB9OTO01q8vb6IGUi/STErDxL24GeuGa8HNQ5MUOnstRtBZrpe3FbJuetPYKWlSmpc3lJew5tog3LhCH20gJ+eS+lv6PJO1HiuqGuCj0Bt8P97deFrik9DNiFUdPjJcrzSL7Dz2z2/HaKr7xY/bUKWMS7sj4kWki1aTDnbPo55BIk5inGm8rMc9YkjZwhfm0QvuBdmbNZqitibLElwu/amXs78zpRR/iHjthLWMptuTBtFbsff9mX/uDPovq+cIQ/T/lwPGiihij56vz3st8sZ7zo+8omQtcGh5uJVRx+8oJKVeuK4cWI2DMNzDnvdBzKt0cjXeLMybt/+nUFFvTq8LkH5iar1eNHojweNT7S4K1WKzyo6mE/1olFos7SFOfJd2N+R1CDYYxJm7mJHfiXCwF+PrMXleqCeMe68UJw/5zc6Fzji4NYmPog6e11SxI+s1ckGRaHoDXADuK4qJVPX53OBBX+5Cdsfk7Z2Jc1lc4uvkF8P71EpTGs0LsWcmcqnihfUJ0kBF441jZRyqf4xJ6Tf3ldSBbSpG7vbrHcYW3LmVI1d7x+64TNI19T/660gbIqf12N/j6GauZy1zC3m8BGXG0nr1CFSw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR11MB5819.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(36756003)(7416002)(6666004)(53546011)(316002)(38350700002)(31696002)(16576012)(110136005)(54906003)(5660300002)(38100700002)(52116002)(2906002)(44832011)(8936002)(66946007)(31686004)(956004)(508600001)(86362001)(66476007)(2616005)(6486002)(186003)(26005)(6706004)(8676002)(4326008)(66556008)(78286007)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =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5YmlqSVRBUjlFdDFJUi9kMXRkdWRU?= =?utf-8?B?emEzbjNJMmFWK1BEWXpneWtOSm55SUNPUG5VeThRUnRDcUFSaytLcWtiUnBW?= =?utf-8?B?U09VcldIUk5VdEVMdTVOUExuV3Y3T3VNVTRDcGN6Q21nZ0ZZZlNnOHhKeEJq?= =?utf-8?Q?ArcOFLSIcCsjgfaAAlrd/4vpCYIUu86n?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9413d2d-568f-4167-69fe-08d9938993da X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB5819.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2021 05:22:15.2492 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: quanyang.wang@windriver.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4854 X-Proofpoint-GUID: M3j9pFuZwwfb_6i5xzJn-giQYN7vy4zD X-Proofpoint-ORIG-GUID: M3j9pFuZwwfb_6i5xzJn-giQYN7vy4zD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-20_01,2021-10-19_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 adultscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 phishscore=0 bulkscore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=603 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110200027 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Ming, On 10/20/21 10:17 AM, Ming Lei wrote: > 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. For now, I can only observe that precpu_ref data is leaked when running ltp testsuite. Thanks, Quanyang > > > Thanks, > Ming >