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 65745CA1009 for ; Fri, 30 Aug 2024 19:44:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2D4A6B0257; Fri, 30 Aug 2024 15:44:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB5DE6B0258; Fri, 30 Aug 2024 15:44:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7D3C6B0259; Fri, 30 Aug 2024 15:44:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 81F126B0257 for ; Fri, 30 Aug 2024 15:44:47 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 23E1D1C1E05 for ; Fri, 30 Aug 2024 19:44:47 +0000 (UTC) X-FDA: 82509939414.29.5843485 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) by imf28.hostedemail.com (Postfix) with ESMTP id 3FEE9C000D for ; Fri, 30 Aug 2024 19:44:44 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=dVp0Xqlr; spf=pass (imf28.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.183 as permitted sender) smtp.mailfrom=shakeel.butt@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=1725046995; 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=2qi8zuVUA51rj6VM4lfmCDpw1uLh7fyiw4/O+HNlVkU=; b=w5HuwrE4gzIFzY0eH+zE1y1yCEf1khcnw6pd+aEnCytuim0b5a/vr6ZZX+Azum6BEP+eGN Rf54IKLleOuD6tcSDUfrIpbGCGi3jrmGB7j5l4YANbKXyrewhxLC6RXB6rj65aCgS8UkKN R2fbOsXQWkm8IlIAwTxBMyu2fL4oFfQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725046995; a=rsa-sha256; cv=none; b=lkBa1UMdWL/D7VWURdhDAP/JhUbe6yBkd2tuN8SzvO/HmqkhDZgr8AK1jmiJddUlB8twtP bnf3JcAlDGpPnvX2hmYCJcEfmNm52hX5G4d6SA1/L5RSD1mOgwrt49DWf9fIyl33Hndyt/ jcAS0JqXHGubCwTPH6j0cJ9B+xtWy8I= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=dVp0Xqlr; spf=pass (imf28.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.183 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev Date: Fri, 30 Aug 2024 12:44:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1725047081; 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=2qi8zuVUA51rj6VM4lfmCDpw1uLh7fyiw4/O+HNlVkU=; b=dVp0XqlriwFTDYo/Ug8DdXCl5PxXyfROEj+MZBbcva2bnnPEvClzifbBZsVY7LSmNDPxKj 041f7SbZDnVAGWqF+XBot0/oGepvgFHnBPPDEkWVAZaPv2kZEjLsecOC5qK608xd1H3we7 hGGAux6SjYVJghdMBrq24ma7VIJTsiE= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Vlastimil Babka Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , 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 v3] memcg: add charging of already allocated slab objects Message-ID: References: <20240829175339.2424521-1-shakeel.butt@linux.dev> <76079f79-2e72-4a59-9eae-3b05ae6b9a9e@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <76079f79-2e72-4a59-9eae-3b05ae6b9a9e@suse.cz> X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 3FEE9C000D X-Stat-Signature: qxksumirqqdm4ak633otaxjhys4ow7cq X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1725047084-92083 X-HE-Meta: U2FsdGVkX1/PHcEyUKxT2lHDnuq8e9WT0zdCBsuH3zVMPne/dCA4lSDX7IZOxmVoHadvpaucNzgoJJFSbbSebwsw658OXhV3HZkMUbjWzzwuTGvhxfFaHGzDVkc31b2/sKuw2jQgXK2Wfi4S106qLkCy8hdEclhZ/H0oJnXvsjGd/z/rLPd5kRq6x8lBB3+Uw2gQgMLxu4uSbO+fPoQXzqBgNbsZmocZhYaN6y7TJdbr708H1uVi4S8KUU0LQRmggGd4yMwneNs1ckHanhY3jIzsMpegZUE2n8pR7f1hj3RTlAD5SCfkvKLCnMwo9123dita2lVyBJk6fNC6VAQt1y/Jl7tLsQnbna+bNWH8yoXBPLJxi/ZKtnoBOZuMaXuZHb3nRqOEv2HGttCDhcsGZzEIA7jyQO+y5x+TY4HksiI76kgQughYbAp3yvSM+tjosscOBGVr3hLrs+Ej+W+Jk8Hgcr2Zli9qJw11vEsWHpmpBBAL1MQnjJ5ICPNddKB7okxKMYrS7AmnXF98qfBzv4NVV9qyNrV8hInfUrO6Bl0QVLba5RE1a5KLKghEsBs3fuYKM/akJnWWypD7jNYdjkkGcMGjEqanlkdRr6kr2oT//I3v+6JWa3QGiwQMBLr4TVFhjScLYKGTZf2nM5nY8cNV9255apokYBRdH2v2UPIgbz0VmUafIKR2WPPrHN/DGtSsdXlbrCs5s1REKMbWoW4s91F/4TgN56OW/85P8tHtlsLV1TLEHABen3DD4sVjf7GxN6du2jWB8VPhx1qm0bxq+C7zrDXhTAqiLfNUU/IOQq/PAVYTntt/jbwNWlBfJ3nC9JzXlsv8dUl6oL03/mHvoNJnShbSB20F1nBqIycW3SShX6BR5QRBj9r2pejE3nExnTrVIIhnpEg8ce3z7zU5lYeppFv5ad88ZhSq4oDQ8Y8X7FVxXzRVmOvRZ0HVtERJZHMarLej8KIlnE3 gyI/tRbe 6IDphe6u6LqjIctWI8ptMGNHZdrpM50u5gLJAL3KcW8vSaAIrbB0n3Q1JU532OOovy9sjfBI6wE6Gp1d/wNQgUNkhvGJZVDv3qsFVlKTjwCap9A+ENY2poBJ7+uEVe3Pwpzmh90l95XcA2pKaS+vvpr7yZOlss2/AkC0pEurlmZ1zPnJ59n7mczTBL332cWuhflhm0CSrYm9ORLEG2xX9aehdHQ6C2rs/YU3JwyYsXA4KZwiAjAXEFCkrJg== 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 Fri, Aug 30, 2024 at 11:07:32AM GMT, Vlastimil Babka wrote: > On 8/29/24 19:53, Shakeel Butt wrote: > > 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 > > Thanks, pushed to slab/for-next for test coverage, hopefully net people will > ack. > > Also one thing: > > We should add some kernel doc for this, no? Explaining when people are > supposed to use this, that objects from KMALLOC_NORMAL will be ignored, and > what the return value means (including where it's faked to be true). > Yes this makes sense. I will add this info similar to the kmalloc() have. Should I send a v4 with this details?