Received: by 10.223.176.46 with SMTP id f43csp2402152wra; Thu, 25 Jan 2018 09:17:27 -0800 (PST) X-Google-Smtp-Source: AH8x227LIM+skWReL5qBMpfUQRmgdQ/A4cKcu7qDdUGv6sEDvXSAYJz0HoGzU3fWFEn/q/lYpXkC X-Received: by 10.99.96.151 with SMTP id u145mr13656604pgb.102.1516900647274; Thu, 25 Jan 2018 09:17:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516900647; cv=none; d=google.com; s=arc-20160816; b=r3/sU1IZJrwQT48teI4zNkOsTVGCJb8YqVWHLWPaES93rJuYJ4uwVUK3iDF6yH6Z1y G/OvbXhPJcJ+7uJIUoS0qmTUbBXA6Pdowf/QB2jzi+b7N7OVzVXw6Wfm2ZLfPpO3b8ev GUtD+b9yKY0WSFVZ5eaRLy854f3UQiePQfNbK4eV3QUsnVWJFegHltZ0xCtbObA/XHWT 0mc0mHdK7HQwBG4SMw/R2CoqP/WcqxsCHvZSBPus37wY92brKk9fmLil35hE9oQsu9B7 iXfRiUzixgAvMjxy7l00x8KkXEVRa7cEI9pkzpr+CIPpWbIz93u1QxtLc5gMjp1tAqGX HLLw== 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=u4bjtaDNjJ/9FJHgBaaKGnKF4MfFMohKepMbKpnU4vM=; b=TtRJYPZk6mxJEcFXfuLpJI9a/f2debyeOr2b1NWGirviYPjJM3gkwdOe+LSU7f1nW7 yw9X9lkO/aWsPvUL1K17E8KeIlgGkaPjh9Sfy3RKlcejshgCajWpCf/Yx/gv7XH1fpsa JkzD3wlO1O0NWMOZyf7Xz6EhuQyeIgWKRYHT9eVYfTZaDTsJgcauE4GvsPAeeR02Rzjj a7eOwc06FKqZ8I67hH6Yq8Impr+Vf2RA+9LrkoG5oiq/vWeTufVQDXj7Ww6VBuTVyV92 DP4nLmnvSCIqqqawt42vzLPQPlAWhcMDbBP/aGeEM2pCwUF/AZVUT+vFOyYy7cTfKPZ2 ifdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=WQE+sqm0; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=FIwBO8MW; 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 x5si1791173pgo.709.2018.01.25.09.17.12; Thu, 25 Jan 2018 09:17:27 -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=WQE+sqm0; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=FIwBO8MW; 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 S1751281AbeAYRQd (ORCPT + 99 others); Thu, 25 Jan 2018 12:16:33 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:39552 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751155AbeAYRQW (ORCPT ); Thu, 25 Jan 2018 12:16:22 -0500 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0PHFBZT005825; Thu, 25 Jan 2018 09:16:14 -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=u4bjtaDNjJ/9FJHgBaaKGnKF4MfFMohKepMbKpnU4vM=; b=WQE+sqm0+hLCNnRaVe/3cU4RaYMrNcZ9UJPMbfusgadcbgsQcr8ErwXtydnqE02C3tsA Cw+BKKNMcGpGHFeGB71kBsVkfW9ElmTjFg2qsfctX1LqLuhQn6fE6gpjZ1VHvPp+UiGD 85T19JMKaR8e3MhyYqDPT2dsYyIqdzkAwow= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2fqjd6g7d3-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 25 Jan 2018 09:16:14 -0800 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.20) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 25 Jan 2018 09:16:12 -0800 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=u4bjtaDNjJ/9FJHgBaaKGnKF4MfFMohKepMbKpnU4vM=; b=FIwBO8MWuRw1UKo9p7mNJRq1FedpUh4pP8jSJpbG34C1MlFY8MG0QyoFsNkxWj4g/+eGGEru8iCc7gVEEpg5f9GkPvqSdssnsfaPWZVA1cjjoVApP4PcGRMt1xD7WYOEYknmSUx6ogq86OA+x9SGaHehjzPMqtNPBnGRJ/DoFX0= Received: from castle.DHCP.thefacebook.com (2620:10d:c092:200::1:fea1) by CO1PR15MB1078.namprd15.prod.outlook.com (2a01:111:e400:7b66::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Thu, 25 Jan 2018 17:16:06 +0000 Date: Thu, 25 Jan 2018 17:15:55 +0000 From: Roman Gushchin To: David Miller CC: , , , , , Subject: Re: [PATCH net] net: memcontrol: charge allocated memory after mem_cgroup_sk_alloc() Message-ID: <20180125171549.GA21946@castle.DHCP.thefacebook.com> References: <20180125001911.15597-1-guro@fb.com> <20180125.120302.1117695034222616751.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180125.120302.1117695034222616751.davem@davemloft.net> User-Agent: Mutt/1.9.1 (2017-09-22) X-Originating-IP: [2620:10d:c092:200::1:fea1] X-ClientProxiedBy: DB6P190CA0032.EURP190.PROD.OUTLOOK.COM (2603:10a6:6:2f::45) To CO1PR15MB1078.namprd15.prod.outlook.com (2a01:111:e400:7b66::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4ba458c5-6f21-496e-d220-08d564175309 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:CO1PR15MB1078; X-Microsoft-Exchange-Diagnostics: 1;CO1PR15MB1078;3:7BU5FuUlaYXVynphqoXLtAXBwyxHM/pIvD9BO8BjcY5Pid0Ixl7brEo0Li+E7sy3hbl0WUUxAxH45LXYzJ5dX98uBYLBjIuUkehec8aMC+Gm1BTF2VG1nHDwE4BCQ7NSwiTVOHpEsruvZNZzgj7fNSA1NXs+UZtPEcRo2OtqxNF/TQcuo+xMxQUqyasXDKockxrUTA31DLfndfAAWQJ9Kn8ZodZB5SME+gX4rx1VvXsPSB2yRbnTg9rFAYb9i6SB;25:xw1MEsQUqOw4uZC5ur21xw0XvPk8puEl1wBD4Gjp8mbmq0z3yMrYixuLDBlGduyAm/rpfGNm/XmqszpRQxU+uXje567b0AIaqH14pEJJHuI4DGcNcelfEJcP+KNm4Gg9ZKkW2qGMvaaix1vlBS/2S6+dg6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UK2nPsrvvjtA8RWKELg/wfIJp+Crjyih8i+lOj2wh1UvfV4loEAwdNUfMkgT/NwNSHBnDUr43Mr4CYaiXIbDsLbGkKlVHLkM8ULJj79xpFD0lbVIIlQ5vRg1AdtQQmXs+8EAjXZ/WHQ157VrA45oNagBdCrvo8RWPRSql/yFlG2dUyxvNZIteOvnjFty83J3bTYicfIcDJxAMI9L36cn7Q1rmrkT1s2ceaWEpudFWc5+GsZ/YMrnFCkSX9Xkjp+KVMqtJkLE X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231023)(11241501184)(2400081)(944501161)(93006095)(93001095)(6041288)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011);SRVR:CO1PR15MB1078;BCL:0;PCL:0;RULEID:;SRVR:CO1PR15MB1078; X-Forefront-PRVS: 0563F2E8B7 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(376002)(39860400002)(346002)(396003)(39380400002)(366004)(199004)(189003)(76176011)(8936002)(81166006)(33656002)(7696005)(6506007)(59450400001)(81156014)(386003)(52116002)(52396003)(5660300001)(8676002)(305945005)(2906002)(2950100002)(6116002)(1076002)(6916009)(7736002)(68736007)(50466002)(6666003)(23726003)(97736004)(83506002)(47776003)(55016002)(9686003)(186003)(53936002)(229853002)(316002)(25786009)(6246003)(105586002)(58126008)(16586007)(106356001)(86362001)(4326008)(478600001)(18370500001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:CO1PR15MB1078;H:castle.DHCP.thefacebook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX: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;CO1PR15MB1078;23:U0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kUKxWF0pHouwHgVWgaV1dvO/NmNDNn+80IlwcuQ9UEgjN4=;7:GM6Cr12xrIdcbhv0GwL6/3nE0l/xlnAzt24X3daxkMHYpZCOeAmFfV9XNWpk7DB9tLv6UyB//pI+0PmdO8ypGhgOIwKbVBoQMlZcEMF5iSh+ezRsnpUWt20mmz+MjyKLWYtWZSBghIeFUBxh8OBDuk9NZXWXzOIPY3SAWHNX7zGy9iwuztmFhl4rEUrQZJQ8YOEddIooH31+KjGGbrEMCetE3tOcfzSunydPVatTrBZtHv7yOnGLkq49khbUVJCV SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CO1PR15MB1078;20:r6ptekM5pgxlBxdbQe7+/Hn2IcdTqXsekMT1tFJTRW141Yr15fcd9iY12YmlrRePNzFV8H4Zb4fm0iMowElbt2nNOjY/jRFEZw+DSveYWxc3Y9FoS5GdjEEIlIXk4bD7YK/aQwU4LXBCl7qxbdy9L+YW77Q0qXA5Z6SK/D8VvT8= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2018 17:16:06.8127 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ba458c5-6f21-496e-d220-08d564175309 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR15MB1078 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-25_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, Jan 25, 2018 at 12:03:02PM -0500, David Miller wrote: > From: Roman Gushchin > Date: Thu, 25 Jan 2018 00:19:11 +0000 > > > @@ -476,6 +477,10 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern) > > spin_unlock_bh(&queue->fastopenq.lock); > > } > > mem_cgroup_sk_alloc(newsk); > > + amt = sk_memory_allocated(newsk); > > + if (amt && newsk->sk_memcg) > > + mem_cgroup_charge_skmem(newsk->sk_memcg, amt); > > + > > This looks confusing to me. > > sk_memory_allocated() is the total amount of memory used by all > sockets for a particular "struct proto", not just for that specific > socket. Oh, I see... > > Maybe I don't understand how this socket memcg stuff works, but it > seems like you should be looking instead at how much memory is > allocated to this specific socket. Yes, this is what I wanted to do originally. Let me find a proper way to do this. Thank you! Roman