[Buildroot] [PATCH v1] package/linux-tools: introduce linux mm tools

Yann E. MORIN yann.morin.1998 at free.fr
Mon Jun 26 15:47:19 UTC 2023


Dmitry, All,

On 2023-06-26 15:12 +0300, Dmitry Rokosov spake thusly:
> Please take a look into this patchset. I appreciate any feedback.

Don't be impatient. Your patch has been pending for about two seeks now.
We have 495 pending patches: https://patchwork.ozlabs.org/project/buildroot/list/
some of witch are so much older...

Yes, I know it can be frustrating. For various reasons, we've been a bit
less active than usual the past few months, but we'll eventually get to
it...

Regards,
Yann E. MORIN.

> On Thu, Jun 22, 2023 at 08:18:06PM +0300, Dmitry Rokosov wrote:
> > Hello,
> > 
> > Add Peter Korsgaard and move "buildroot" mailing list from Cc.
> > 
> > Could you please take a look at this patchset? I believe that linux-mm
> > tools are helpful for investigating kernel memory distribution in
> > embedded systems.
> > 
> > On Fri, Jun 09, 2023 at 02:34:15PM +0300, Dmitry Rokosov wrote:
> > > 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 at 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
> > > 
> > 
> > -- 
> > Thank you,
> > Dmitry
> 
> -- 
> Thank you,
> Dmitry

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list