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 C4B8DC54E49 for ; Tue, 27 Feb 2024 16:10:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55EDB280026; Tue, 27 Feb 2024 11:10:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 50F0628001D; Tue, 27 Feb 2024 11:10:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38E30280026; Tue, 27 Feb 2024 11:10:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1BF9928001D for ; Tue, 27 Feb 2024 11:10:59 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D384F80D15 for ; Tue, 27 Feb 2024 16:10:58 +0000 (UTC) X-FDA: 81838072596.09.E2FA814 Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf24.hostedemail.com (Postfix) with ESMTP id 35165180028 for ; Tue, 27 Feb 2024 16:10:57 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=ekYBx3jU; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of surenb@google.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709050257; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3997VUdAcSrw6hJXGBCDEHFxh3lqzFAtRC+eH0EMEcI=; b=XtdkSKRjTKp42aGWmvavBQ1abk5NpQDPWjrTWielD59TpNoJ6g3dSmRjojbmMn9/rof0uM G+negoKoGOT0WqOCKPqBrxXyda+mNpJtRmbPU5cW0bwjxiS6Q2F26VFx5doyVoTyiu/8an eL6YkHWrhQS5nbjWJawJp+vhHlGSWeI= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=ekYBx3jU; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf24.hostedemail.com: domain of surenb@google.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709050257; a=rsa-sha256; cv=none; b=g8vFUKx52zawPUBJvNcV9okQiHcmUM8KzSm6a7IpyEQOzfu5jT4L4qiZ+GA5i4iuwJBQTP sAh54uPcosHRLoTX8WOKWNWfdTtZ9fIDFGhpeExDpETt7LefgxYj5zaFft3GIBp25KMsJI 6EG/Zqbpj0CFtwcwZwv733N7Gare90k= Received: by mail-yb1-f176.google.com with SMTP id 3f1490d57ef6-dc6d8bd618eso4573945276.3 for ; Tue, 27 Feb 2024 08:10:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709050256; x=1709655056; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3997VUdAcSrw6hJXGBCDEHFxh3lqzFAtRC+eH0EMEcI=; b=ekYBx3jUhB/lyYk27Iz+WpGjzsQn6hr2kyfdO7u0A+CNrqaiEqNYshZmdBWD41V7dH iC299e33TPTte/Sg4vquBGWJTCeRSqBhMNDvaERefhouvq5M5hDhG7SF0XMrary3cYKj 90fZIlklUXRselwiw/9sCQHlr781oCDoGd+rYdHpmZDOkmc9dcUY4WG1+QxyMZ0XffYn CyXX5suo6o6qx0bWyFi4vxrOF0lICsyKmc1Q0e0u2P/22ot0T8IB/vdNV5u6Rn4KYnWH fuJXUUN7VPhMKz3qWINVVy6b4K7ikZFrKFs+XDl00kCdxtJ/VhTriPGz3UyAZWzh6MXK fjcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709050256; x=1709655056; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3997VUdAcSrw6hJXGBCDEHFxh3lqzFAtRC+eH0EMEcI=; b=dtWxVybDNX2hbuWyrBDjINdbSb4AUBNupBjprWmMgoCWXzKKPn6jk18iY9GJNeQMm+ KFkC6f66ZaxuKWY8uKte4mQJ/XvIkk4nothi+f6t2PS2u/jVhRx801JKbe2gjwSiGp1a M1oKavJJD2+82cnpjxWsAo4Q7LRUYYzhVo36txWN1ZF5fpD5qeA4mO4jTSR6HVg/Vter 38k6wdl3ORwfSlrxrUVIMl07j8aIW7p+65X8wm2C5dM6R/t6/N7i9xkr8AF4g34lpa73 G7UHi0Pyjugoz9DNDIBZIpAKkptA8cGJgbUCCI86J4PAcd54OOqX4zB1kvvfdldi/+8u bEUw== X-Forwarded-Encrypted: i=1; AJvYcCVhRMly6OXvXjTRAb+Tp016BOUKr3DYR9plPwHXfuJcC+cCYTznOpJBhflNZ7IxFB7scMf9w5r5G4WRxoBZDSiPoBQ= X-Gm-Message-State: AOJu0YznBkPv9sI7xTcUwynuExe9paqu2JfYlWMo6R0FpXYDp4V20n6G fPatQGYMDr3DLq1udAJCmUSmUr98r95WYtl1CrvUd42uQeDnyBDNqkG/+8SbKBDA7rchJT/vcUy FrVRe4E41wOBrUWJq62kja9X+jj4QGhK+GwP/ X-Google-Smtp-Source: AGHT+IEHPBI8sanvwTrodqkBZscFpfJ5hxIGD0OGV0J9ftpRl85Uhg0i/fQvfgLElKHDPIfjBMGZnSSbq41lp7tF8gc= X-Received: by 2002:a25:874c:0:b0:dcb:d8d1:2d52 with SMTP id e12-20020a25874c000000b00dcbd8d12d52mr2322309ybn.31.1709050255947; Tue, 27 Feb 2024 08:10:55 -0800 (PST) MIME-Version: 1.0 References: <20240221194052.927623-1-surenb@google.com> <67453a56-d4c2-4dc8-a5db-0a4665e40856@suse.cz> In-Reply-To: <67453a56-d4c2-4dc8-a5db-0a4665e40856@suse.cz> From: Suren Baghdasaryan Date: Tue, 27 Feb 2024 08:10:43 -0800 Message-ID: Subject: Re: [PATCH v4 00/36] Memory allocation profiling To: Vlastimil Babka Cc: akpm@linux-foundation.org, kent.overstreet@linux.dev, mhocko@suse.com, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, penguin-kernel@i-love.sakura.ne.jp, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.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, vvvvvv@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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 35165180028 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: tqqxzmspkbnsb71twg634za61okhnji5 X-HE-Tag: 1709050257-950804 X-HE-Meta: U2FsdGVkX18UI/hjsPG3XSRZr5H/OveKILiqs6Ce2mOES3WFh0Zd38m2481Lqg6rbLB9UJB/R2KqxYKRqUtPGosg54KPmzdmVjd4TF+LW82Z9mzbglj4q6pVWJn7J2NmzxFvHONAk6+e0nayD3ST0CyHZfLZEvFEHMysqfUsgNAZ0dbnGn7u90vdzp3vmk55f7Z+aYvyWtwjq3CVQCx4PmccJAn49iS+LwjPcvNm+uI2R5XCjXHZlty4d1fZoDVJJdl5NHo/l8lm48FCP6xll0+X5NzcYJxK8B5xe4XKQYJ5HyyavkTYMFl555fpkPyqV/rHxi20mjeK9Dj4ypa1NaAm/rnBJBU4gnbGPrt7dipll05YC1tsxhloVWIA8myx8FneyXKt0pzwf33rMSjTkVk06oLEkGwIb/1642jfzhAcQM/YS3ynQU3L4pF6QeGL6E1XQtOvu1pkoWTuQAYGla0Z9akqjAUcBLJDqxuH+fr7Z5gaky7X9hb+KQX/mev/J77jCQBdiDvJWcD+7V7p0ZuTARa9z5A5s+gwt+2J7yQT2eA+E9Vm4Q+LK8D7OUXKCSbdCssrxzNfU+dqDXYN/mj+6dn6SDhO0wCih8dkcuhiL3va67e2P6+KWjliJrtg4NczTeb9O4jHRFsd/BnHrcFruYdpTBtw6C8qfLn/1m44wWQKc8J3tWslYPN3zed3rYae/cpjOKkUdJy7rZ4UA5VxPf++fmb/fKtY0XKlUXWhRdn2fTxB3G6SdCdQO2hKYK69HP35Dq5XU/63vVd8VM4g4gKaEjufpjnbad+77y9Kw8xL3sJYjUVafsNuR9oCfggwQjW/QTZ035FGkoOEtDJeqkEGcs4lGJGIgnlV6+w9dlREcrvKPU/7Vu1GrrF6EkvwONHhNIVIdaY7R6aDs50AYCRIoMA7zkpZMNq7jQxEY/mKtmXEyNZ9h2gwqhTwjAVtDZ4VASnLX/JKWnJ cDXE88Tp 4vMgCB7WZI1+KJAugckCNOLEkPKxN74zEx7KNFKIYWZ2xGVZhmqqzIiFmeUkQjvAGH+BV 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, Feb 27, 2024 at 5:35=E2=80=AFAM Vlastimil Babka wr= ote: > > On 2/21/24 20:40, Suren Baghdasaryan wrote: > > Overview: > > Low overhead [1] per-callsite memory allocation profiling. Not just for > > debug kernels, overhead low enough to be deployed in production. > > > > Example output: > > root@moria-kvm:~# sort -rn /proc/allocinfo > > 127664128 31168 mm/page_ext.c:270 func:alloc_page_ext > > 56373248 4737 mm/slub.c:2259 func:alloc_slab_page > > 14880768 3633 mm/readahead.c:247 func:page_cache_ra_unbounded > > 14417920 3520 mm/mm_init.c:2530 func:alloc_large_system_hash > > 13377536 234 block/blk-mq.c:3421 func:blk_mq_alloc_rqs > > 11718656 2861 mm/filemap.c:1919 func:__filemap_get_folio > > 9192960 2800 kernel/fork.c:307 func:alloc_thread_stack_node > > 4206592 4 net/netfilter/nf_conntrack_core.c:2567 func:nf_ct= _alloc_hashtable > > 4136960 1010 drivers/staging/ctagmod/ctagmod.c:20 [ctagmod] fu= nc:ctagmod_start > > 3940352 962 mm/memory.c:4214 func:alloc_anon_folio > > 2894464 22613 fs/kernfs/dir.c:615 func:__kernfs_new_node > > ... > > > > Since v3: > > - Dropped patch changing string_get_size() [2] as not needed > > - Dropped patch modifying xfs allocators [3] as non needed, > > per Dave Chinner > > - Added Reviewed-by, per Kees Cook > > - Moved prepare_slab_obj_exts_hook() and alloc_slab_obj_exts() where t= hey > > are used, per Vlastimil Babka > > - Fixed SLAB_NO_OBJ_EXT definition to use unused bit, per Vlastimil Ba= bka > > - Refactored patch [4] into other patches, per Vlastimil Babka > > - Replaced snprintf() with seq_buf_printf(), per Kees Cook > > - Changed output to report bytes, per Andrew Morton and Pasha Tatashin > > - Changed output to report [module] only for loadable modules, > > per Vlastimil Babka > > - Moved mem_alloc_profiling_enabled() check earlier, per Vlastimil Bab= ka > > - Changed the code to handle page splitting to be more understandable, > > per Vlastimil Babka > > - Moved alloc_tagging_slab_free_hook(), mark_objexts_empty(), > > mark_failed_objexts_alloc() and handle_failed_objexts_alloc(), > > per Vlastimil Babka > > - Fixed loss of __alloc_size(1, 2) in kvmalloc functions, > > per Vlastimil Babka > > - Refactored the code in show_mem() to avoid memory allocations, > > per Michal Hocko > > - Changed to trylock in show_mem() to avoid blocking in atomic context= , > > per Tetsuo Handa > > - Added mm mailing list into MAINTAINERS, per Kees Cook > > - Added base commit SHA, per Andy Shevchenko > > - Added a patch with documentation, per Jani Nikula > > - Fixed 0day bugs > > - Added benchmark results [5], per Steven Rostedt > > - Rebased over Linux 6.8-rc5 > > > > Items not yet addressed: > > - An early_boot option to prevent pageext overhead. We are looking int= o > > ways for using the same sysctr instead of adding additional early bo= ot > > parameter. > > I have reviewed the parts that integrate the tracking with page and slab > allocators, and besides some details to improve it seems ok to me. The > early boot option seems coming so that might eventually be suitable for > build-time enablement in a distro kernel. Thanks for reviewing Vlastimil! > > The macros (and their potential spread to upper layers to keep the > information useful enough) are of course ugly, but guess it can't be > currently helped and I'm unable to decide whether it's worth it or not. > That's up to those providing their success stories I guess. If there's > at least a path ahead to replace that part with compiler support in the > future, great. So I'm not against merging this. BTW, do we know Linus's > opinion on the macros approach? We haven't run it by Linus specifically but hopefully we will see a comment from him on the mailing list at some point. > > -- > To unsubscribe from this group and stop receiving emails from it, send an= email to kernel-team+unsubscribe@android.com. >