Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions 18 crash/commands/kmem.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,21 @@

from crash.commands import Command, ArgumentParser
from crash.commands import CommandError, CommandLineError
from crash.types.slab import kmem_cache_get_all, kmem_cache_from_name
from crash.types.slab import slab_from_obj_addr, KmemCacheNotFound
from crash.types.node import for_each_zone, for_each_populated_zone
from crash.types.vmstat import VmStat
from crash.util import get_symbol_value
from crash.exceptions import MissingSymbolError
from crash.cache.syscache import config

if config["SLUB"]:
slub_kernel = True
else:
slub_kernel = False
try:
from crash.types.slab import kmem_cache_get_all, kmem_cache_from_name
from crash.types.slab import slab_from_obj_addr, KmemCacheNotFound
except TypeError:
slub_kernel = True

class KmemCommand(Command):
""" kernel memory inspection"""
Expand All @@ -56,6 +65,11 @@ def execute(self, args: argparse.Namespace) -> None:
self.print_vmstats()
return

if slub_kernel:
# not supported for now
print("-s and address options not supported on non-SLAB systems")
return

if args.slabname:
if args.slabname is True:
print("Checking all kmem caches...")
Expand Down
2 changes: 1 addition & 1 deletion 2 crash/types/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def setup_nodes_width(cls, symbol: Union[gdb.Symbol, gdb.MinSymbol]) -> None:
# TODO: handle kernels with no space for nodes in page flags
try:
cls.NODES_WIDTH = int(config['NODES_SHIFT'])
except (KeyError, DelayedAttributeError):
except (KeyError, TypeError, DelayedAttributeError):
# XXX
print("Unable to determine NODES_SHIFT from config, trying 8")
cls.NODES_WIDTH = 8
Expand Down
6 changes: 5 additions & 1 deletion 6 crash/types/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,9 @@ def _last_run__timestamp(self) -> int:
def _last_run__last_arrival(self) -> int:
return int(self.task_struct['sched_info']['last_arrival'])

def _last_run__return_zero(self) -> int:
return 0

@classmethod
def _pick_last_run(cls) -> None:
fields = types.task_struct_type.keys()
Expand All @@ -601,7 +604,8 @@ def _pick_last_run(cls) -> None:
elif 'timestamp' in fields:
cls._get_last_run = cls._last_run__timestamp
else:
raise RuntimeError("No method to retrieve last run from task found.")
cls._get_last_run = cls._last_run__return_zero
print("No method to retrieve last run from task found. Consider enabling CONFIG_TASKSTATS and CONFIG_TASK_DELAY_ACCT to activate CONFIG_SCHED_INFO kernel config")

def last_run(self) -> int:
"""
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.