Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4492444rwj; Tue, 20 Dec 2022 10:49:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf7LJWEgF9o7juo+C05IQtKBOJcOYv6svYYX0aHChyqidLNmFrPriGcNMJiDNIMhmSwstLUM X-Received: by 2002:a17:902:d4cb:b0:189:d0b4:52d0 with SMTP id o11-20020a170902d4cb00b00189d0b452d0mr67472281plg.46.1671562153906; Tue, 20 Dec 2022 10:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671562153; cv=none; d=google.com; s=arc-20160816; b=RplFZKhSMtQp3H7SQxw+BD0+P8YJFuSP2JH4wX6SRnthlsedXbi9Ptftgl2VeXckEg ThwYMXsup39PGYRZLYslE8fHNTwjamCj+uMhhtXU0kzsYTBih28FyHeuj2xlYi7SawGZ 9QhZ8FU18wL1ZYj3RAM0d8p+u87HUgf3FrHTuCJFSSSxn0TKDkenZTX6CadSdZDvE8qg MjyM8X6JlL5rg0sc0H42kvTlZ09pXj+F3sXrvNbDXjGUyrk9XWX1DztBMEDPbU+s2Z/2 eka/jkDZAnorpU0b/KbN/9Os+Mg5oNG9Pj8YRLfI4upFtdsAy6G88ZMUHvHVHWi7H20r Ryyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Fg7QsgWuG0CK6tIt3L6718+/M9y6wWUM/N8cNALh9TI=; b=Uo+iNJ2N6dgpSSrzU5DzUj7wYVbtnjBU6KVSOZQuDuyI16BWF/b2fdkhy0K9BqNoW0 oix2jFDufaq95lzTlgCDaxMAZN5EhlpTIEUStkZJ9edRwYj/myOh/jOWEa82faxgGdZY 7os20cFWC8XZDAglf1wIYUhSG8XYZ5Md0al1By93e4Rxo9UVHve1qZYL4fYNBoFAOVWS 9NpjQu/1RgG7M/ZLaqigghm0fhv4KY3fSfCRkGGfBEmMeHiDOOGdSsofDCAzszC+C0dJ aVZ1kAX3Jvjtfm8nxcRBp/Af89qlz7PkdB2VmMKIb0lWEGH6zjawOOryYJse9d7qOhOn XD+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ZHVNnOLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t6-20020a170902bc4600b0017c887295fbsi13512127plz.420.2022.12.20.10.49.05; Tue, 20 Dec 2022 10:49:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ZHVNnOLp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233991AbiLTS2N (ORCPT + 70 others); Tue, 20 Dec 2022 13:28:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229756AbiLTS2F (ORCPT ); Tue, 20 Dec 2022 13:28:05 -0500 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1172FCE07; Tue, 20 Dec 2022 10:28:03 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1671560881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Fg7QsgWuG0CK6tIt3L6718+/M9y6wWUM/N8cNALh9TI=; b=ZHVNnOLpMF+Ywc7fWfYrtgEJG7ECKPNcowJh37ZPNcPXh37spKjvpph0drQIetn8FffIYU 3uVakPqt+fudCFRJgjA5Fx+RTpdJ6Rc4DVHwgYHe6JVo6Dnq6hLyjc7+8HKqabHCxkpipV D0OC2p5gt02s6fn4ps0pVPWnG7XrepY= From: Roman Gushchin To: linux-mm@kvack.org Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Shakeel Butt , Johannes Weiner , Michal Hocko , Muchun Song , Andrew Morton , Roman Gushchin Subject: [PATCH RFC 0/2] mm: kmem: optimize obj_cgroup pointer retrieval Date: Tue, 20 Dec 2022 10:27:43 -0800 Message-Id: <20221220182745.1903540-1-roman.gushchin@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset improves the performance of get_obj_cgroup_from_current(), which is used to get an objcg pointer on the kernel memory allocation fast path. Results (1M 8-bytes accounted allocations): | version | accounted (us) | delta | unaccounted (us) | delta | |-----------------+----------------+-------+------------------+--------| | baseline (6.1+) | 81042 | | 45269 | | | patch 1 | 78756 | -2.8% | 42731 | -5.6% | | patch 2 | 73650 | -9.1% | 30662 | -32.3% | Unaccounted allocations were performed from a user's task belonging to the root cgroup, so savings are particularly large because previously the root_mem_cgroup pointer was obtained first just to learn that it's corresponding objcg is NULL. Roman Gushchin (2): mm: kmem: optimize get_obj_cgroup_from_current() mm: kmem: add direct objcg pointer to task_struct include/linux/sched.h | 4 ++ mm/memcontrol.c | 102 ++++++++++++++++++++++++++++++++---------- 2 files changed, 83 insertions(+), 23 deletions(-) -- 2.39.0