Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v1] package/linux-tools: introduce linux mm tools
@ 2023-06-09 11:34 Dmitry Rokosov via buildroot
  2023-06-22 17:18 ` Dmitry Rokosov via buildroot
  2023-07-23  9:14 ` Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 8+ messages in thread
From: Dmitry Rokosov via buildroot @ 2023-06-09 11:34 UTC (permalink / raw)
  To: Thomas Petazzoni, Yann E . MORIN, Herve Codina
  Cc: kernel, Dmitry Rokosov, sdfw_system_team, rockosov, buildroot

This toolset was designed to facilitate the testing, monitoring, and
tracing of various things with virtual memory, pages, and slab objects.
It is an invaluable resource for identifying and analyzing
memory-related issues, such as leaks and bottlenecks, and can greatly
enhance one's understanding of memory utilization within a system.

The mm toolset includes:
    - page_owner_sort: userspace helper to sort the output of
      /sys/kernel/debug/page_owner, which helps to know who allocates
      the page from kernel context
    - slabinfo: the tool which gets reports about slabs, for example
      show empty slabs, modify of slab debug options at runtime, display
      all information about a slabcache
    - page-types: a handy tool for querying page flags

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
---
 package/linux-tools/Config.in           | 18 ++++++++
 package/linux-tools/linux-tool-mm.mk.in | 59 +++++++++++++++++++++++++
 2 files changed, 77 insertions(+)
 create mode 100644 package/linux-tools/linux-tool-mm.mk.in

diff --git a/package/linux-tools/Config.in b/package/linux-tools/Config.in
index 880ad08f0f1c..3ecc45574b82 100644
--- a/package/linux-tools/Config.in
+++ b/package/linux-tools/Config.in
@@ -171,4 +171,22 @@ config BR2_PACKAGE_LINUX_TOOLS_HV_VSS_DAEMON
 
 endif # BR2_PACKAGE_LINUX_TOOLS_HV
 
+config BR2_PACKAGE_LINUX_TOOLS_MM
+	bool "mm"
+	select BR2_PACKAGE_LINUX_TOOLS
+	help
+	  mm is a toolset for testing/monitoring/tracing vm/pages/slabs objects.
+
+	  - page_owner_sort: userspace helper to sort the output of
+	  /sys/kernel/debug/page_owner, which helps to know who allocates
+	  the page from kernel context
+
+	  - slabinfo: the tool which gets reports about slabs, for example
+	  show empty slabs, modify of slab debug options at runtime, display
+	  all information about a slabcache
+
+	  - page-types: a handy tool for querying page flags
+
+	  These tools are available only from kernel version 3.4.
+
 endmenu
diff --git a/package/linux-tools/linux-tool-mm.mk.in b/package/linux-tools/linux-tool-mm.mk.in
new file mode 100644
index 000000000000..a59f1c46ff97
--- /dev/null
+++ b/package/linux-tools/linux-tool-mm.mk.in
@@ -0,0 +1,59 @@
+################################################################################
+#
+# mm
+#
+################################################################################
+
+LINUX_TOOLS += mm
+
+MM_MAKE_OPTS = $(LINUX_MAKE_FLAGS) CC="$(TARGET_CC)"
+
+KVER = $(shell echo $(LINUX_VERSION_PROBED))
+KVER_MAJOR = $(word 1,$(subst ., ,$(KVER)))
+KVER_MINOR = $(word 2,$(subst ., ,$(KVER)))
+
+# For the first time tools/vm was introduced in the 3.4 kernel version
+KVER_MAJOR_MIN = 3
+KVER_MINOR_MIN = 4
+
+# Starting from 6.3 kernel version mm tools are located at tools/mm folder
+# instead of tools/vm
+KVER_MAJOR_MM = 6
+KVER_MINOR_MM = 3
+
+define MM_BUILD_CMDS
+	$(Q)if [ $(KVER_MAJOR) -lt $(KVER_MAJOR_MIN) ] || \
+		[ $(KVER_MAJOR) -eq $(KVER_MAJOR_MIN) -a \
+		  $(KVER_MINOR) -lt $(KVER_MINOR_MIN) ]; then \
+		echo -n "Your kernel version $(KVER_MAJOR).$(KVER_MINOR) is "; \
+		echo "too old and doesn't have the mm tools." ; \
+		echo -n "At least $(KVER_MAJOR_MIN).$(KVER_MINOR_MIN) "; \
+		echo "kernel must be used." ; \
+		exit 1 ; \
+	fi
+
+	$(Q)if [ $(KVER_MAJOR) -gt $(KVER_MAJOR_MM) ] || \
+		[ $(KVER_MAJOR) -eq $(KVER_MAJOR_MM) -a \
+		  $(KVER_MINOR) -ge $(KVER_MINOR_MM) ]; then \
+		MM=mm; \
+	else \
+		MM=vm; \
+	fi; \
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+		$(MM_MAKE_OPTS) $${MM}
+endef
+
+define MM_INSTALL_TARGET_CMDS
+	$(Q)if [ $(KVER_MAJOR) -gt $(KVER_MAJOR_MM) ] || \
+		[ $(KVER_MAJOR) -eq $(KVER_MAJOR_MM) -a \
+		  $(KVER_MINOR) -ge $(KVER_MINOR_MM) ]; then \
+		MM=mm; \
+	else \
+		MM=vm; \
+	fi; \
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+		$(MM_MAKE_OPTS) \
+		INSTALL_ROOT=$(TARGET_DIR) \
+		DESTDIR=$(TARGET_DIR) \
+		$${MM}_install
+endef
-- 
2.36.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-06 19:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09 11:34 [Buildroot] [PATCH v1] package/linux-tools: introduce linux mm tools Dmitry Rokosov via buildroot
2023-06-22 17:18 ` Dmitry Rokosov via buildroot
2023-06-26 12:12   ` Dmitry Rokosov via buildroot
2023-06-26 15:47     ` Yann E. MORIN
2023-06-27 10:24       ` Dmitry Rokosov via buildroot
     [not found]         ` <m25xz16e14.fsf@ja.int.chopps.org>
     [not found]           ` <20240206115217.3r43du5b4wnt23a7@CAB-WSD-L081021>
2024-02-06 19:47             ` Dmitry Rokosov via buildroot
2023-07-23  9:14 ` Thomas Petazzoni via buildroot
2023-07-24 11:03   ` Dmitry Rokosov via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox