From nobody Sun Feb 8 14:31:16 2026 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 146D82E0B6E for ; Thu, 24 Jul 2025 13:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753365409; cv=none; b=glg9lJdFkLO3rNeLe5NLZNNd2n7lRpGV6dWQdbgSW+oQzSxnfU52lKAS+hTUIhTzXTXqzmlF/bbXcirm5TNwsDb5Go/2zUK0UoCcpcEovY1WWDATd0VzZJFKiso4zjFWohhLg9uqh2USHQUiosMyVbqo+UsJdsu9trxtsyCUl0M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753365409; c=relaxed/simple; bh=4mzNhzQY8HFx0bk+CHpi6+2DgmZYfQ8vHH6EB20MlrE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XRAiuEYRWOhK9bSQ/j+yOzPQOf4YeGs8lcnrDxGiDiSUOc/XKWiXilxw8qfUqkszSbfoSYD7A1MEyGUUQyjhDf+wCHcWJzBPw6XW8QM9N3vMl31niGw8sRRedYDiQAgc2JpXbyyVgzNCPRlVxO1GH/tengWC49vqnVUN3DYuaOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=iClEbVMJ; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iClEbVMJ" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3a588da60dfso649681f8f.1 for ; Thu, 24 Jul 2025 06:56:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1753365403; x=1753970203; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h5mN880WCISqsqqypOE0OCrYzPzbEuiPZ0HVDAJk/kA=; b=iClEbVMJGbk/PyxXaSMMcxMAAqWn6IMjOCGbXGY4SbpO6tWlrOvED9WZH1STFKee6Y hHtDKSjj9AXb/itAOMfu+NlNgcBkRokxFC5lEdIpCJJ+u0F3wh8ftd0RFHgtT2YaraSq ketGNDB0x/WxBU3SwLV8Obj3mnpIWnW4qIcuRREvISdg4EGUpwQhA4rQRanVEWxhschX QLhS77NmD3AasXN5Yqd1WPeHDUyi4MJVAtLajTy+fiY3NdBPLN5juxw4sHLap8dmWM+E K4f+4lYqgXd1aplpdLav6VbqVnXZ3qrRTthuhfvreR8lU17u+Vsgb2/2AhqcfcZPWSjc BIdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753365403; x=1753970203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h5mN880WCISqsqqypOE0OCrYzPzbEuiPZ0HVDAJk/kA=; b=SL+vn0LQyoH31fP+gmaSAsinnZQ9CIq4N58iN1izieMTWuT3/R6Pl0qslHgUZC0k+u dg0I4Zm8e2j4DzNHzg8HcdLw2TS7mvi1MOIt2hRkiKvfgLkg3shezy87HRpgOrZf/IMd ColppNKFF2WwAEg6qSfzlm4pJMWvjUjL5UZd8BdZlt1AXFg+3tZbLPNoZtnOVZITvTaS PCWMiAe2fjjKOxniHHXRFlb0jz8SXRWqV90K7AjXqtDsjtOeLfiLhYq3/YW1EBmJ26O1 tvJSUdaDSNhMtsZWBtt/YTXchRD7QLK26zeUO/d42N4mXA45+JyHjt43XPPD3khGoaL9 lRMw== X-Gm-Message-State: AOJu0YzaRJc8O3HmD5UwFysffL7E76AiTcBwgp/8aGPBN14uhLFrM5sA Pmx+wakCg9qLUvvhUUznBMrQigAajRJkqkzUXclke7Ly0W4WtjmvDD/AORPkw13oRNp6xrgojEo tUBQAJXU= X-Gm-Gg: ASbGnct67KvZQycR1ksmUQFTZg77dy9X2IzUmQRACmEifAgahzfF/AB4Ruwm8g7+eyg Yk+g135TWstCAoWlvLatWvxaeB2ncBV6Ije6r7FxZkden3ttGei/ZYvpl/Q35AFI5VTWhOBvJrG 2zvjpjt4UNAoH2O1pUqp6c8jRt0qOB1d4OgUkOLHU6vqKcCI79NdxgH1+2XAIka+/gFGTOgSosI iY5fand0u5PYfLQsKlf6RSssLsVs6c6bgkXKqyx+i7oiIn4UYRkzEmc/KCjEkDxy69DpmJ70jAU XZPxGR+v1g82TTLxu0q8zs1YT1umJaHgdtxFsymka08BvsykXJuPG1by8cTFTOIgFdW/f3nxUOf UH0ntLo6vqdGAH9D9L3abcXxccSuOpnD1zerv18xe+VGUmb7oJVBrySg2tTeyI54tY48vJ01WA8 +vAch0i0H1cmuZbBuVQk1zF90= X-Google-Smtp-Source: AGHT+IF4egT06XIAWuc0TJnVdNpe1wQ7sn3xvEGeH8Rc0pzDJnMJjBpN4GYnZW+sz3u5f7Eq0JGLQw== X-Received: by 2002:a05:6000:3103:b0:3b5:dc05:79b with SMTP id ffacd0b85a97d-3b768cb0f15mr6041122f8f.14.1753365402888; Thu, 24 Jul 2025 06:56:42 -0700 (PDT) Received: from eugen-station.. (cpc148880-bexl9-2-0-cust354.2-3.cable.virginm.net. [82.11.253.99]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4587054e37dsm20889375e9.14.2025.07.24.06.56.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jul 2025 06:56:42 -0700 (PDT) From: Eugen Hristev To: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, tglx@linutronix.de, andersson@kernel.org, pmladek@suse.com Cc: linux-arm-kernel@lists.infradead.org, linux-hardening@vger.kernel.org, eugen.hristev@linaro.org, corbet@lwn.net, mojha@qti.qualcomm.com, rostedt@goodmis.org, jonechou@google.com, tudor.ambarus@linaro.org Subject: [RFC][PATCH v2 23/29] mm/sparse: Register information into Kmemdump Date: Thu, 24 Jul 2025 16:55:06 +0300 Message-ID: <20250724135512.518487-24-eugen.hristev@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250724135512.518487-1-eugen.hristev@linaro.org> References: <20250724135512.518487-1-eugen.hristev@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Annotate vital static information into kmemdump: - mem_section Information on these variables is stored into dedicated kmemdump section. Register dynamic information into kmemdump: - section - mem_section_usage This information is being allocated for each node, so call kmemdump_alloc_size that will allocate an unique kmemdump uid, and register the address. Signed-off-by: Eugen Hristev --- mm/sparse.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mm/sparse.c b/mm/sparse.c index 3c012cf83cc2..04b1b679a2ad 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "internal.h" #include =20 @@ -30,6 +31,7 @@ struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS= _PER_ROOT] ____cacheline_internodealigned_in_smp; #endif EXPORT_SYMBOL(mem_section); +KMEMDUMP_VAR_CORE(mem_section, sizeof(mem_section)); =20 #ifdef NODE_NOT_IN_PAGE_FLAGS /* @@ -67,10 +69,11 @@ static noinline struct mem_section __ref *sparse_index_= alloc(int nid) sizeof(struct mem_section); =20 if (slab_is_available()) { - section =3D kzalloc_node(array_size, GFP_KERNEL, nid); + section =3D kmemdump_alloc_size(array_size, kzalloc_node, + array_size, GFP_KERNEL, nid); } else { - section =3D memblock_alloc_node(array_size, SMP_CACHE_BYTES, - nid); + section =3D kmemdump_alloc_size(array_size, memblock_alloc_node, + array_size, SMP_CACHE_BYTES, nid); if (!section) panic("%s: Failed to allocate %lu bytes nid=3D%d\n", __func__, array_size, nid); @@ -252,7 +255,9 @@ static void __init memblocks_present(void) =20 size =3D sizeof(struct mem_section *) * NR_SECTION_ROOTS; align =3D 1 << (INTERNODE_CACHE_SHIFT); - mem_section =3D memblock_alloc_or_panic(size, align); + mem_section =3D kmemdump_alloc_id_size(KMEMDUMP_ID_COREIMAGE_MEMSECT, + size, memblock_alloc_or_panic, + size, align); } #endif =20 @@ -338,7 +343,8 @@ sparse_early_usemaps_alloc_pgdat_section(struct pglist_= data *pgdat, limit =3D goal + (1UL << PA_SECTION_SHIFT); nid =3D early_pfn_to_nid(goal >> PAGE_SHIFT); again: - usage =3D memblock_alloc_try_nid(size, SMP_CACHE_BYTES, goal, limit, nid); + usage =3D kmemdump_alloc_size(size, memblock_alloc_try_nid, size, + SMP_CACHE_BYTES, goal, limit, nid); if (!usage && limit) { limit =3D MEMBLOCK_ALLOC_ACCESSIBLE; goto again; --=20 2.43.0