Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5795767rwr; Mon, 1 May 2023 10:52:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5y+No3uAlwrA+Rz6gyUbbxIHZ21PceMndDlA7g35J5fJmj5Ka3LpkLv6JDf+I49WUVYgaj X-Received: by 2002:a05:6a20:a5a6:b0:f2:5b9f:fe61 with SMTP id bc38-20020a056a20a5a600b000f25b9ffe61mr16892861pzb.34.1682963535438; Mon, 01 May 2023 10:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682963535; cv=none; d=google.com; s=arc-20160816; b=xZZLd9X2t2C5i0CGOMnTuG6WnOjcgMW5E1628WjYibTk5O32O3oV+AdkqI4iKpnpVm qoRzotCH7cLbK8v6yziyER1FMznd3IpZxu5r/PoDaif2oEctrCqcH98b2rGOJku9tvvK mwwSOeumr3R/V4Gg9lYE49sWeQ9xaX34jNWoG+iKiDGXdcbvPOlI0Ki2brq14Iax++zd dbODIHLM8NcAMJiEhIKTnhScjdij8ssMQ9XK8I9Hg7blxPYQvwG4uPX88lWnDPvvhZPx YFNe6VXS5+s4Nk70ykjgvzugxrIREhb3hZMHKUEPqh7wqcDoW2z5UJUmERCT88Mw+IFR 8Rog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=pCOJ4TIX11zw2jBaDOP97T7hx/pG0LP03OwHceiD+AE=; b=gIJ2DnRhC7AcvU3zk9G1NnQ2Gp6GN6fs8CwhKHevg2x42In3FfEvUvnHImPZhLVaAx nBjQ8aNI/lThjzDdDAS5HjcaHEboKf9ddqIpsEAhZ+ZIcydwc6P30N/khUmdeO3qImGr 4sCvuPoei7YXBGlniTQlUzldvvhUyy2Qz82yTQD52Y4KgPSbk1rQmLr4+r//JOkL/FVF tC/Pwnz+x0BK8AK4CgEB2MwxSlL1lwjcHni/FRpaSaJ0tgK/Ni+sszMmq2fhNyUuJjfM zHeXWR25AaHr9JNeoXMWiHdb60/GqemMKmXgCUWJ9r78kirpapVGUM7ye78AK3hHKCOs Tz9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=DiqG+Df4; 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 a192-20020a6390c9000000b00528c16e927asi8567693pge.95.2023.05.01.10.52.03; Mon, 01 May 2023 10:52:15 -0700 (PDT) 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=DiqG+Df4; 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 S232182AbjEARr0 (ORCPT + 99 others); Mon, 1 May 2023 13:47:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbjEARrZ (ORCPT ); Mon, 1 May 2023 13:47:25 -0400 Received: from out-10.mta1.migadu.com (out-10.mta1.migadu.com [95.215.58.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAE76E5B for ; Mon, 1 May 2023 10:47:23 -0700 (PDT) Date: Mon, 1 May 2023 10:47:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1682963238; 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=pCOJ4TIX11zw2jBaDOP97T7hx/pG0LP03OwHceiD+AE=; b=DiqG+Df4D+DZsn0wO9LjwkV/mLuZ3abtM/u+Nuamt3enIlxM0dOl/zDiGUemCbI1ba6Ge7 UFxA8r7ovThZ0bL+PW2tO2CTjinF1Mnn4ax/lyq+OVwg8tX+hPdBw7CohOYds+psfqGMqa jFVVfskQ2Ze12DnahYd6juPiFkLzBag= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, kent.overstreet@linux.dev, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, ldufour@linux.ibm.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Subject: Re: [PATCH 00/40] Memory allocation profiling Message-ID: References: <20230501165450.15352-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230501165450.15352-1-surenb@google.com> 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_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Mon, May 01, 2023 at 09:54:10AM -0700, Suren Baghdasaryan wrote: > Performance overhead: > To evaluate performance we implemented an in-kernel test executing > multiple get_free_page/free_page and kmalloc/kfree calls with allocation > sizes growing from 8 to 240 bytes with CPU frequency set to max and CPU > affinity set to a specific CPU to minimize the noise. Below is performance > comparison between the baseline kernel, profiling when enabled, profiling > when disabled (nomem_profiling=y) and (for comparison purposes) baseline > with CONFIG_MEMCG_KMEM enabled and allocations using __GFP_ACCOUNT: > > kmalloc pgalloc > Baseline (6.3-rc7) 9.200s 31.050s > profiling disabled 9.800 (+6.52%) 32.600 (+4.99%) > profiling enabled 12.500 (+35.87%) 39.010 (+25.60%) > memcg_kmem enabled 41.400 (+350.00%) 70.600 (+127.38%) Hm, this makes me think we have a regression with memcg_kmem in one of the recent releases. When I measured it a couple of years ago, the overhead was definitely within 100%. Do you understand what makes the your profiling drastically faster than kmem? Thanks!