From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D193CA1013 for ; Fri, 30 Aug 2024 20:34:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36A0A6B026F; Fri, 30 Aug 2024 16:34:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 31A2A6B0270; Fri, 30 Aug 2024 16:34:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2095D6B0271; Fri, 30 Aug 2024 16:34:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id EC3966B026F for ; Fri, 30 Aug 2024 16:34:57 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 837FC1C49F8 for ; Fri, 30 Aug 2024 20:34:57 +0000 (UTC) X-FDA: 82510065834.08.19F2E00 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) by imf20.hostedemail.com (Postfix) with ESMTP id 9FEB31C0011 for ; Fri, 30 Aug 2024 20:34:55 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=BOti94d7; spf=pass (imf20.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.218.175.189 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725050074; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=N2MSZCjedrpsmWdTZ6nvWovh/uXXPtdm+g3LPj1tQbc=; b=XUvqaQFh/zHijpEobnzVtkzox7LHUbwBA+yzi/VD1JyEsyoPB+WdV2ogtpc8Q2tez87l9R QW+fWSJSpe4FF8oSkcVJKetRMNkJdOnrIWai27yfKPsZGackDqxD45eP0u3fZWsfA9MWJK /CBY7zlbxme5jznMilsDpeoUP2v6E3E= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=BOti94d7; spf=pass (imf20.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.218.175.189 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725050074; a=rsa-sha256; cv=none; b=gYTvcX/TEwfsVhtN0zDbBNgWILXgFAekkz0GgVzhcvABplqlG2lUXgZ3EzdrgrwN9ioZlB 9BpWVIjsRByTJl8W3Mm5fPLn2wDO13L7XMsj39schjhsISk2mvP+ZMwp5DM5hEy4ML0QIg SujZW3xgHUXp+fYr4TeUUFyHOOmBgpU= Date: Fri, 30 Aug 2024 20:34:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1725050093; 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: in-reply-to:in-reply-to:references:references; bh=N2MSZCjedrpsmWdTZ6nvWovh/uXXPtdm+g3LPj1tQbc=; b=BOti94d7W0NPg/IHRInQnb6PRJY9TO9UZceWZQtPuLKwNaHmSFPyhW/a1EFIupa4RsHq4G OUmVh944d6mSiaejsihDCCf568qT6aj+JhSkM44cEXYP9nTaQQLCh3NijTC6OjUEodkVB1 7nL2FE4ym7bVmNk7Lz6fIoEX7R+B9hA= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Shakeel Butt Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Muchun Song , Vlastimil Babka , David Rientjes , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Eric Dumazet , "David S . Miller" , Jakub Kicinski , Paolo Abeni , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v2] memcg: add charging of already allocated slab objects Message-ID: References: <20240827235228.1591842-1-shakeel.butt@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240827235228.1591842-1-shakeel.butt@linux.dev> X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Stat-Signature: kk44wsyyftk9u86hwijmz48wbnnb1cfp X-Rspamd-Queue-Id: 9FEB31C0011 X-Rspamd-Server: rspam11 X-HE-Tag: 1725050095-474748 X-HE-Meta: U2FsdGVkX1/MfvX68MWfF/VdgkehF+pDUNMfJ/K3sKiKJE1G080o1lX9I9rhxQgaMhAdsxwa66u7hx5EB5wcVcEFTjL9C2OCyppyYq5DKu0EVSN+Gefn+nXWym5GahTuHp7dLtJQWSfF+NISxxzapCJ1woWCTW/KwihZBvQnrB4l5nFUg4t3ytpMMZ9Y9ZnAAm8pkaJOWKWUaEpsfk4jfvGgqyBR+qPRwIbvTQF9YKIPG3aBox6W4eJJ1P7ADH5ya64gvDuSichiwnwJUCJtrQzxedrkBByjfh24lyjM+KWjucvTqD6uraEQAuvqF5DpYp28QnHnQAZ4wupfaGd7HGaRXVd7hnn+GnP9McohRE0RrZpVjtxf5SowBL4nJLM7wOTVrnj6WNJZARnT/Waj5Hf0++R/FiTsyqCGBQtPcSD3qLxcFn2D0wcrVIrSGClyPWccogUKu5hYe810dxmc3M3CBmZAAkoJdIPk7ejSALdhfqMTZxfvMe6z7+AmEMXx++SMfWf/yLVbGsmiyX0OjuMa5TDm9GyhtpO2nFNlUuOJPs867r6QHO4fwx5F6q4AvIUD4zRrIStf7SMir24gzDoD2+KsnBthM52ABhpHig0uAy6BRt9EK8mH4Kxdp6hk94XQ7MD1EsnkFSG43ZBfzxcrxb7JjaCR8Of5YbNqWcsr1Qb48Z4U7rsUOC1Gmh90Z87A8D40IBTTYiILuka57qLh8+nM+/TOKGcV3ZpFNu8xnXM3LI/7V8hNEKDKsToNo66swYOvPQsprzDzIllUyGEHXNCfwergwZmenRmHKpTFLHmCH59VAEElazmRGakiQkJUj2qnwTYKPlmFJvbn4kT2t4t3DkAG1+GusXkopSFuZ7qsTubDCsW2/sXO2i1OilrGys3YqTFWsC1bi3tMGpZorlPJ0oA4Bim3TtaOQ+j9d4bDY9MuaF+g2yff6/2AcbCQNBFr+MtiPQUeEZi xYwedQW7 q/SlI5zAuaBEMzOMQceSYU8dCDkngyQ8XIO6mp827uJ8BmXaNOP2D/pzk4bLT3/EkNYg0E21PXWFU2JRCCaf9l+Mhy2bn1iH+E4QsVAzseNeWRzHrjdtxKbQplA+o0MKOq5ihpOoaJu1QEy9wPIo13kzPsK1IIefHWNOxjabzPNd4PItXdA0Sk9y3f2UeI1LsAu82Mg5R/DlGTdo53SrCJMF9H63V9oqGyULuBMrK+lU04w9cmKxQ4tKFEO7OxgMsZmqp72PY6gBEhuRFudxMUv6Whw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Aug 27, 2024 at 04:52:28PM -0700, Shakeel Butt wrote: 41;2500;0c> At the moment, the slab objects are charged to the memcg at the > allocation time. However there are cases where slab objects are > allocated at the time where the right target memcg to charge it to is > not known. One such case is the network sockets for the incoming > connection which are allocated in the softirq context. > > Couple hundred thousand connections are very normal on large loaded > server and almost all of those sockets underlying those connections get > allocated in the softirq context and thus not charged to any memcg. > However later at the accept() time we know the right target memcg to > charge. Let's add new API to charge already allocated objects, so we can > have better accounting of the memory usage. > > To measure the performance impact of this change, tcp_crr is used from > the neper [1] performance suite. Basically it is a network ping pong > test with new connection for each ping pong. > > The server and the client are run inside 3 level of cgroup hierarchy > using the following commands: > > Server: > $ tcp_crr -6 > > Client: > $ tcp_crr -6 -c -H ${server_ip} > > If the client and server run on different machines with 50 GBPS NIC, > there is no visible impact of the change. > > For the same machine experiment with v6.11-rc5 as base. > > base (throughput) with-patch > tcp_crr 14545 (+- 80) 14463 (+- 56) > > It seems like the performance impact is within the noise. > > Link: https://github.com/google/neper [1] > Signed-off-by: Shakeel Butt Reviewed-by: Roman Gushchin Thanks!