From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A023A25771 for ; Thu, 25 Jun 2026 18:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782413348; cv=none; b=Yvc2KmwvNsEqkngXdVEDv5dQcUoUDQwYXInMwpYddBzrHKgSMkx4z/x23wNQJdTro6dlol1LOZizEVR5W31u+OHRdA88mwUqwaSmJOtBczHyJAaMaADu+H12dubIDSX+ESk3eCIOtGpWjvBWk+EJq6rxhmQVr7dvBqTtzXlQHBg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782413348; c=relaxed/simple; bh=d5OqVuhdBoRIOOLPSjtqbV4ais+11+wcjRpxozzF9dg=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=mrA3E+/H7Gq/HFccxVKWIWuIQOxe7SO8l4U/hereDr0/9tIeHwB/9iWOZ+cgfCcV3/yZgOMyjTtBeILj5sCVFCMjZkbGvkEPxJGHFDGDu2I+maWkZEYGMKrPW5SXY18euhU45IRW88FrCWbEJpm5TpdkZYTRJisl6EFF33o/4V4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=f2WqGGsZ; arc=none smtp.client-ip=74.125.82.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="f2WqGGsZ" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-137f3465368so331288c88.1 for ; Thu, 25 Jun 2026 11:49:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782413346; x=1783018146; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=PljyuUHvnv7Sc3Pl2TIaDdc5arqbRo7b/02GpkBHtD8=; b=f2WqGGsZsql5kSb797+oquaRNriugCy8hify+qMELqeycFvqL1ln2DjqvQwNGyUt8I 4Ac+nsF0wB5xa/xpVW9BFzKElr10BkzbJUVRXVnxFveus3704PL2nwUvAmZ37lcWpFn4 oOWALKCYwbEdi4osmjgB9HwJxPVWFGiA9jkW63QjRQFHGBQaxe2K05cr8B7eGPKZqTfn aPhNfFOzROdHN5d5UP2ebyqRJ4EBqkZvt/kFnsRnaY2EcY0H2dNLqbk2bA3xPth8eNpa 1BVKUSgo0rbiVuF2QUE42Rhz0CEPvaGYF6s1Qm5iggs2fXoSZv3aGpwFPjTnW8KQLk2j 6Z0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782413346; x=1783018146; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PljyuUHvnv7Sc3Pl2TIaDdc5arqbRo7b/02GpkBHtD8=; b=PYn/wN1RabHxK62uSbGb3kcEFhvekTxGHLXJBYoPydK0xCxp/yTnQkwT2+PhBirrEe STioA6Aec/u+kah7/sMbAyEqFWtNuK/DVkAAPqsBzNjyscvFFr9xD8JchKbRQADGrb2U T+x+tFQxTKMbQ6eb41Vg3zujNYcLbrOQWh3Jg8jAQkLwVED4pxu3stOGOmrllcyccJA8 9L7giYyJbcq9t3onu4hAfHMCzmQZoFljQmLf7uBJUB6sL7Dzks/T3/6ASUZoQbnHl0pg 00iS7zQP1sRzydH814AOVRecDxhmVNyHOc6JT2nlICdg0O3qIYk7KrsEJF+9L6JEaWhI 1UTg== X-Forwarded-Encrypted: i=1; AFNElJ/NK+0kWpUrPyX2tiidSuTwdXEbOgVFfjj3bKJXHUsUNGwGyKT2oGcVISDQJXTWPRJCzPAK3cyVqYXxGW0=@vger.kernel.org X-Gm-Message-State: AOJu0Yzq2PLo1BIN79zW83P1Aa9dI+F+rOn+EJqBVLU8H45DyKBO/7OU 9mKSNgE6SIQhIoTsXQJOq5ohLo9Z+qh83+9qDODyPbdxoX3MJ8EI39qZfC+NU4xDbSFNpl0M+35 fpk1eow== X-Received: from dlbsj2-n1.prod.google.com ([2002:a05:7022:f902:10b0:139:bb10:9e5c]) (user=surenb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:1707:b0:139:beba:8216 with SMTP id a92af1059eb24-139dbbafdc1mr2041359c88.30.1782413345354; Thu, 25 Jun 2026 11:49:05 -0700 (PDT) Date: Thu, 25 Jun 2026 11:48:57 -0700 In-Reply-To: <20260625184857.2193482-1-surenb@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260625184857.2193482-1-surenb@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260625184857.2193482-3-surenb@google.com> Subject: [PATCH 2/2] mm: move alloc tag to mm From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: kent.overstreet@linux.dev, david@kernel.org, ljs@kernel.org, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, hao.ge@linux.dev, jackmanb@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, surenb@google.com Content-Type: text/plain; charset="UTF-8" From: Lorenzo Stoakes The alloc tagging work is really mm-specific, so move alloc_tag.c to mm/ and additionally update the MAINTAINERS entry to place it within memory management and port over the Kconfig and Makefile code to mm. Signed-off-by: Lorenzo Stoakes Signed-off-by: Suren Baghdasaryan --- MAINTAINERS | 20 ++++++++++---------- lib/Kconfig.debug | 28 ---------------------------- lib/Makefile | 1 - mm/Kconfig.debug | 28 ++++++++++++++++++++++++++++ mm/Makefile | 1 + {lib => mm}/alloc_tag.c | 0 6 files changed, 39 insertions(+), 39 deletions(-) rename {lib => mm}/alloc_tag.c (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 0948dc573744..3cf3cf2311e2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -16704,16 +16704,6 @@ F: mm/mm_init.c F: mm/rodata_test.c F: tools/testing/memblock/ -MEMORY ALLOCATION PROFILING -M: Suren Baghdasaryan -R: Hao Ge -L: linux-mm@kvack.org -S: Maintained -F: Documentation/mm/allocation-profiling.rst -F: include/linux/alloc_tag.h -F: include/linux/pgalloc_tag.h -F: lib/alloc_tag.c - MEMORY CONTROLLER DRIVERS M: Krzysztof Kozlowski L: linux-kernel@vger.kernel.org @@ -16758,6 +16748,16 @@ T: quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new F: mm/ F: tools/mm/ +MEMORY MANAGEMENT - ALLOCATION PROFILING (ALLOC TAG) +M: Suren Baghdasaryan +R: Hao Ge +L: linux-mm@kvack.org +S: Maintained +F: Documentation/mm/allocation-profiling.rst +F: include/linux/alloc_tag.h +F: include/linux/pgalloc_tag.h +F: mm/alloc_tag.c + MEMORY MANAGEMENT - BALLOON M: Andrew Morton M: David Hildenbrand diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 8ff5adcfe1e0..3762015522c3 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1048,34 +1048,6 @@ config CODE_TAGGING bool select KALLSYMS -config MEM_ALLOC_PROFILING - bool "Enable memory allocation profiling" - default n - depends on MMU - depends on PROC_FS - depends on !DEBUG_FORCE_WEAK_PER_CPU - select CODE_TAGGING - select PAGE_EXTENSION - select SLAB_OBJ_EXT - help - Track allocation source code and record total allocation size - initiated at that code location. The mechanism can be used to track - memory leaks with a low performance and memory impact. - -config MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT - bool "Enable memory allocation profiling by default" - default y - depends on MEM_ALLOC_PROFILING - -config MEM_ALLOC_PROFILING_DEBUG - bool "Memory allocation profiler debugging" - default n - depends on MEM_ALLOC_PROFILING - select MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT - help - Adds warnings with helpful error messages for memory allocation - profiling. - source "lib/Kconfig.kasan" source "lib/Kconfig.kfence" source "lib/Kconfig.kmsan" diff --git a/lib/Makefile b/lib/Makefile index f33a24bf1c19..44f6538533a9 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -197,7 +197,6 @@ obj-$(CONFIG_OF_RECONFIG_NOTIFIER_ERROR_INJECT) += \ obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o obj-$(CONFIG_CODE_TAGGING) += codetag.o -obj-$(CONFIG_MEM_ALLOC_PROFILING) += alloc_tag.o lib-$(CONFIG_GENERIC_BUG) += bug.o diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug index 91b3e027b753..5737a504efbb 100644 --- a/mm/Kconfig.debug +++ b/mm/Kconfig.debug @@ -320,3 +320,31 @@ config PER_VMA_LOCK_STATS overhead in the page fault path. If in doubt, say N. + +config MEM_ALLOC_PROFILING + bool "Enable memory allocation profiling" + default n + depends on MMU + depends on PROC_FS + depends on !DEBUG_FORCE_WEAK_PER_CPU + select CODE_TAGGING + select PAGE_EXTENSION + select SLAB_OBJ_EXT + help + Track allocation source code and record total allocation size + initiated at that code location. The mechanism can be used to track + memory leaks with a low performance and memory impact. + +config MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT + bool "Enable memory allocation profiling by default" + default y + depends on MEM_ALLOC_PROFILING + +config MEM_ALLOC_PROFILING_DEBUG + bool "Memory allocation profiler debugging" + default n + depends on MEM_ALLOC_PROFILING + select MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT + help + Adds warnings with helpful error messages for memory allocation + profiling. diff --git a/mm/Makefile b/mm/Makefile index eff9f9e7e061..4fc713867b9b 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -147,3 +147,4 @@ obj-$(CONFIG_SHRINKER_DEBUG) += shrinker_debug.o obj-$(CONFIG_EXECMEM) += execmem.o obj-$(CONFIG_TMPFS_QUOTA) += shmem_quota.o obj-$(CONFIG_LAZY_MMU_MODE_KUNIT_TEST) += tests/lazy_mmu_mode_kunit.o +obj-$(CONFIG_MEM_ALLOC_PROFILING) += alloc_tag.o diff --git a/lib/alloc_tag.c b/mm/alloc_tag.c similarity index 100% rename from lib/alloc_tag.c rename to mm/alloc_tag.c -- 2.55.0.rc0.799.gd6f94ed593-goog