feat(mem): add KernelStack field for ExVirtualMemory on linux by shirou · Pull Request #1986 · shirou/gopsutil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the KernelStack field to both the VirtualMemoryStat struct and the Linux-specific ExVirtualMemory struct. This field was previously missing but is available in Linux's /proc/meminfo. The change ensures that kernel stack memory usage is captured and exposed through both the general and extended memory statistics APIs on Linux.

Key Changes:

  • Added KernelStack field to VirtualMemoryStat struct with camelCase JSON tag
  • Added KernelStack field to Linux-specific ExVirtualMemory struct
  • Updated Linux parsing logic to populate both KernelStack fields from /proc/meminfo

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mem/mem.go Added KernelStack field to VirtualMemoryStat struct between Sunreclaim and PageTables
mem/ex_linux.go Added KernelStack field to Linux-specific ExVirtualMemory struct
mem/mem_linux.go Added parsing logic for KernelStack from /proc/meminfo, populating both main and extended memory stats
mem/mem_test.go Updated expected JSON string in test to include kernelStack field
mem/mem_linux_test.go Added KernelStack values to test cases where the field is present in corresponding test data files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.