Received: by 10.223.176.5 with SMTP id f5csp69095wra; Thu, 1 Feb 2018 15:44:05 -0800 (PST) X-Google-Smtp-Source: AH8x225sq31ykTogXdRACWOQ+O89qpCSmXgamJXh5GBsEkGNhth0hmpTrBFacD7blYLbnwnY8d9a X-Received: by 10.98.170.24 with SMTP id e24mr38356043pff.177.1517528645292; Thu, 01 Feb 2018 15:44:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517528645; cv=none; d=google.com; s=arc-20160816; b=lS3SMQ0YbKhKoJ8KhY/SXaAYWVH75iEqLLMHdTCZE2Aar+nbb7pptD+3lZEZas01ak B2RLxrxIQsOiWJPPEWeDOfVd41+zBVR6Sp0YpnKhO6bFZ9kXVUpAa0pND+DKFw0MJ74r hEkSDYxkT1aCMPwLT9X/pb9O8qCMheC6u/DQWtbXJIwUj6P6zXTnCPM+xlbcuWOqxq6Q lgzILb9Asb5PMY3XNTpd/8nLphMLECHy2PrpgBZFahhLYkzX30agnznD7jTZIciacYBC BuD8Q6te/qJ0igCNEpvOyiEBgbA3lcw8WDI7liQ82sXETxEB6aHVhslhhWA+6ArLbONr lxMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature:arc-authentication-results; bh=CdhKGWZbntLT820mit9PseOX+00EKSF5bOXmZTDSWU0=; b=c6Qik738AvbxMXbayFSqzZiy/Z4yUdmsmWIiSWAhaBvGccsrrINXKukhXHoYGvD4DC qfSkIATf5Nr5ISy96LbC0IVTaYZuF5S5WdwAylOR6ffJOrPmUyCYOisTpmtQssHMZS5M gXIErkwppW7KljfGId8eTkKmgJbUchZWBrhOeY1FcXYQiWkA60WoCHnzdvEfRZ7rCeZo 6F2Abu1au6gEv9zYh0DEziRKq5Ce67G4yYw/TiU4WnIL3BTKrcX3D+MnbiMXbSj4HsD7 UO3+XRTGa96vxef4o2KIA4tArhQqAx0WHdHTvsTrKDoMeonvyzzGtUUfBnXBRMA7ORbA yyWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=WBxE7JLX; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=ZWHJmOIK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m37-v6si599810plg.37.2018.02.01.15.43.50; Thu, 01 Feb 2018 15:44:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=WBxE7JLX; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=ZWHJmOIK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751738AbeBAXnX (ORCPT + 99 others); Thu, 1 Feb 2018 18:43:23 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:34228 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751629AbeBAXnM (ORCPT ); Thu, 1 Feb 2018 18:43:12 -0500 Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w11NgwqD015747; Thu, 1 Feb 2018 15:43:00 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=facebook; bh=CdhKGWZbntLT820mit9PseOX+00EKSF5bOXmZTDSWU0=; b=WBxE7JLXNlcJIlicie04qE6r5f4YFbVGEIrP6VBL5N04Ff2MEXjRldgA59EmBVAqfqZz flUtNEBVWbMDtAEeLy2Aem/e7EJTUr9PN6NrhUW+cpjmuyhZzWCnxDdgtTFia3gU8ADR EMhAb8yW4I7xjlqL3UHpSyjWvVghpzw9Di4= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2fvasxrsnw-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 01 Feb 2018 15:43:00 -0800 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.32) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 1 Feb 2018 18:42:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=CdhKGWZbntLT820mit9PseOX+00EKSF5bOXmZTDSWU0=; b=ZWHJmOIKo/a8lvS6GPiKaG98nuNXEcYwGa7h8c6IG1ItXSOu2XYm9zx2zvD4G3cYr5uY/R4bZ4oA+E7Ofpurp0rrwygEJJgMMRBEHFXgnmXxAPc076ZfGe1PPQOgO9GQR3Mty+nFmwnkiUXM2yRhbvVyhUhRroVL/h3sY5zF/PY= Received: from castle (2620:10d:c092:180::1:8ad2) by SN2PR15MB1088.namprd15.prod.outlook.com (2603:10b6:804:22::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Thu, 1 Feb 2018 23:42:45 +0000 Date: Thu, 1 Feb 2018 23:42:33 +0000 From: Roman Gushchin To: Eric Dumazet CC: "David S. Miller" , netdev , LKML , kernel-team , Johannes Weiner , Tejun Heo Subject: Re: [PATCH net] net: memcontrol: charge allocated memory after mem_cgroup_sk_alloc() Message-ID: <20180201234226.GA14400@castle> References: <20180125001911.15597-1-guro@fb.com> <20180125.120302.1117695034222616751.davem@davemloft.net> <20180131215401.GA8956@castle> <20180201.101655.1316424669256047119.davem@davemloft.net> <20180201202158.GA11477@castle.DHCP.thefacebook.com> <20180201225542.GA13072@castle> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Originating-IP: [2620:10d:c092:180::1:8ad2] X-ClientProxiedBy: HE1PR0202CA0038.eurprd02.prod.outlook.com (2603:10a6:3:e4::24) To SN2PR15MB1088.namprd15.prod.outlook.com (2603:10b6:804:22::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4b09be9b-2150-4c3c-5bc2-08d569cd7fcf X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:SN2PR15MB1088; X-Microsoft-Exchange-Diagnostics: 1;SN2PR15MB1088;3:SIfkwmlFCqW+mNh6gVfi1IaaXfDBju00k+ebU1LraQxV5GnaL2kyy0ZgoJ0FFwcfPelkbllX0AbD8jwxlfZWvLI6FDuSd4C28vlfGMtvB70sXBZan7cKvuK4uGXxlsSUDezrvB376k95grC8CxtEqckwSYFZFcjl63hBBzBgj6ebjrHE0A1nGTM17El/87Ybqeyd53J+AknYVeKbaq4ok1f/pd1H/xGhDPzDRbezakxDz5diLVklAM2Hj9/luAEG;25:G7nNpPa50cQAXvoeDlLpTu0276RHrIas84UjUjnHDuvG3KY5Lqv8fqHIR6WLbdTpaaDh/FiXtVPUOHU2gUI2kZ68cShpbnwVkSbY2RhuuxNbOWfXBNHEC1a60I+G/Gtcli/knFbMIza94BPqam4gTTevD3lncZYMJ8CV5rUYAVERHedZj2W55TzqUipD/JMF9HFcL6/2MD4EU7ePzpSv70jIUpvVMZkUo0wiwulI8LVYG46h20AK3jBd73PEtxN7asVeUcXF5aIC+O1aPmaxqMdGkqWIZMUoCB/Z+D+jx/u45S9MJwDdd9KxWLnazrTAVZK3s6TywzCwZRYz8jaloQ==;31:kMNOqwRCO8kBlrr9cpPxNoOSzAPXrolUiOenpK+UMHtU39py1S/gIdteHHlZgh9qil9GdVkXqFHB5RR3FO5cI+3ukiiwPn2hrSxpTrTxntYfLPp5nH4yRs9J1DAXTURrfd+HlWVr15tqT/aYeQHUeJlZgqqR8+QIgWkQOKkq8MkHtVLvSWSDSw0mY38FS/FCt7mMaZQ6QLfMhWqu4erXYTC1gTWzflJ3/o9fld9e5yE= X-MS-TrafficTypeDiagnostic: SN2PR15MB1088: X-Microsoft-Exchange-Diagnostics: 1;SN2PR15MB1088;20:PDJ16b19WzswlSQVg3SK++g2gdbBF/lIHcp13nFiUAR5Ie+4boPwXFkn8alW1ZC32r57nhfbLLVH4mH0b4OFnsoJjeGz63CE08vpeOM1NPfsCsT/EERkAfPUMOT5q4BDDdJthudw0XbM3QlkuKi9LFgfQv36EJYxpZdPtpyCE/its0pG23ndpvBjABBD1s05+0C4YZ9EtmCllg0GoT2tifrAobHYsYDMCjPOX5o6Y60wkWR12venBFxugV8ueA0ZCYfIiKnRlm59w7kUQhl/EOrBaNqRh2C285aSJP4HsQkOAhBsIqKka64fXI4ap1TVlodddCXFkBTTvfeP0Ddm72S0c3FguJK5ECizDzzoB7MDjbRcb2Ef7euGQIc7ACFcEpQz9hRxA/bEjdolat40sTfilTurFUCW3Xmk/wJgdkYNg98mP04hws49CbDZswpshf3lxzkGyG/I9qEL6CDES6NM89v7MhMU1kscSP7qF+mK9Y0cogeHHRvpfTTyYskI;4:HYBSSicWHeDq11F6KSfqcW1+wNWOw95AZiYBVHfXAMLQI6sfZrKj9z2VpI3F6LVhRdiBQjjHAH+SpzfweeAboBcNZmH6F3R2LcXKr0DJ+hrsv8Mp+Z756D6vnRX2MtQIw+JPDjLiXyD6aMqlLWpifDmnK8Kd2jgJ1n3TDy72VBP0hm/PnwX767cEze5DcqViSUl/pawm175PW+mmz60hg1Hfli0g7N8OIVU0kxvkdB8wgMA1osf8f5LMXxj8BrVUw4KiSanOsrRP30WFLtQMJjOSOd6/+p9BcZOmaXR2TrBc28BNj09ed//6SUyza+XV X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(84791874153150); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231101)(11241501184)(2400082)(944501161)(10201501046)(6041288)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011);SRVR:SN2PR15MB1088;BCL:0;PCL:0;RULEID:;SRVR:SN2PR15MB1088; X-Forefront-PRVS: 0570F1F193 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(39860400002)(376002)(346002)(39380400002)(396003)(366004)(189003)(199004)(51444003)(81156014)(86362001)(33656002)(54906003)(106356001)(52396003)(97736004)(16586007)(93886005)(58126008)(6496006)(966005)(105586002)(316002)(9686003)(55016002)(47776003)(6306002)(2950100002)(25786009)(53936002)(6666003)(6916009)(33716001)(186003)(50466002)(23726003)(59450400001)(52116002)(2906002)(8676002)(68736007)(33896004)(8936002)(386003)(6116002)(6246003)(81166006)(1076002)(76176011)(305945005)(4326008)(16526019)(229853002)(83506002)(478600001)(5660300001)(7736002)(18370500001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:SN2PR15MB1088;H:castle;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR15MB1088;23:J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nOlwTG9HrzaYpP9ezsvY0GmO34UYrwSmVgy9WKiql3/D7Co3t+6ngfyPuvVQ/hF1/1OEML1bwsXhtYmiFXc9DkemWdPrXH7yh2cB71YVIgvdAOBkDLxOrRU47bTJp8/69iqCW50=;24:zpxaPYvnrYWLz4fQrQSvr3WQwkba7360JRW1weNfzes+Ifb54FmRvS+1L5YyWpItgNFm1R/8GpvfIvhyiVj+nzJosj6xIpXfznUEkvjEERE=;7:bQqebtLf15YOr7ijPAThHnTq6UKxv61Hyutcbnbpr3GUZz2u4SqNJeiLOYBrQZTd/GsxtTvVcljIBKWzAWld4Ucco+ZNGYCeOsPw/u/NrgArUXx4+q/tC5JV8uLWlyk7lSgJEwJSglhdJR/8aafVA2ZUYWMBQZ3s9A1b5UVcXiaiGkLsyZw1SQ0BHJTIyvOn9msk+G5PRcu2SIUqp4pCsEQSNXi/rLj/5Y71L5XAeZLUI0x6xixo5MLWOAesp7AC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN2PR15MB1088;20:0mtC69h0iSDqwrwAuhDBQl/tmaqPQuSRmOevP8tzmlBBB1PXgnBmzFg9Yd9kyZ6yL5T0g1mlBfd5ptE9X30ULaGzEUO5odXtEkuLxQ03n0+vEAwrZAuWYaUWpl1/t7s6XJ5M+hCt8u/Wtcdxib6lm0ZIavLnvnN1rYN47fvecWU= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2018 23:42:45.7394 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b09be9b-2150-4c3c-5bc2-08d569cd7fcf X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR15MB1088 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-01_07:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 01, 2018 at 03:27:14PM -0800, Eric Dumazet wrote: > Well, this memcg stuff is so confusing. > > My recollection is that we had : > > > https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=d979a39d7242e0601bf9b60e89628fb8ac577179 > > https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=75cb070960ade40fba5de32138390f3c85c90941 > > https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git/commit/?id=c0576e3975084d4699b7bfef578613fb8e1144f6 > > And commit a590b90d472f2c176c140576ee3ab44df7f67839 as well > > Honestly bug was closed months ago for us, based on stack traces on the wild. > > No C repro or whatever, but reproducing it would be a matter of > having a TCP listener constantly doing a > socket()/setsockopt(REUSEADDR)/bind()/listen()/close() in a loop, > while connections are attempted to the listening port. Oh, I see... Then I think that we should return memcg_sk_alloc() back to the bh context, where cgroup_sk_alloc() is, and repeat all the tricks to avoid copying dead cgroups/memcg pointers. Do you agree? I'll try to master a patch and reproduce the issue. Thanks!