Merge ~michal-maloszewski99/ubuntu/+source/iotop:ubuntu/jammy-devel into ubuntu/+source/iotop:ubuntu/jammy-devel

Proposed by Michał Małoszewski
Status: Work in progress
Proposed branch: ~michal-maloszewski99/ubuntu/+source/iotop:ubuntu/jammy-devel
Merge into: ubuntu/+source/iotop:ubuntu/jammy-devel
Diff against target: 104 lines (+84/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/lp1982727-config_task_delay_acct.patch (+75/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
git-ubuntu import Pending
Review via email: mp+444488@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

SRU template attached to the bug report

Unmerged commits

070a3c7... by Michał Małoszewski

changelog

61ddf7a... by Michał Małoszewski

Fix the iotop package to show valid data

d/p/lp1982727-config_task_delay_acct.patch: Fix the iotop which did
not show the valid disk usage data due to sysctl_task_delayacct which
was missing. (LP: #1982727)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 6e03788..76172b6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
1iotop (0.6-24-g733f3f8-1.1ubuntu0.1) jammy; urgency=medium
2
3 * d/p/lp1982727-config_task_delay_acct.patch: Fix the not valid
4 data coming from iotop by detecting the kernel.task_delayacct
5 sysctl value. (LP: #1982727)
6
7 -- Michal Maloszewski <michal.maloszewski@canonical.com> Fri, 09 Jun 2023 11:25:54 +0200
8
1iotop (0.6-24-g733f3f8-1.1build2) jammy; urgency=high9iotop (0.6-24-g733f3f8-1.1build2) jammy; urgency=high
210
3 * No change rebuild for ppc64el baseline bump.11 * No change rebuild for ppc64el baseline bump.
diff --git a/debian/patches/lp1982727-config_task_delay_acct.patch b/debian/patches/lp1982727-config_task_delay_acct.patch
4new file mode 10064412new file mode 100644
index 0000000..cb3d7d5
--- /dev/null
+++ b/debian/patches/lp1982727-config_task_delay_acct.patch
@@ -0,0 +1,75 @@
1From ab35334d374e588bec12d201fb8869c536f0545d Mon Sep 17 00:00:00 2001
2From: Paul Wise <pabs3@bonedaddy.net>
3Date: Sat, 2 Oct 2021 12:13:16 +0800
4Subject: [PATCH] Detect the kernel.task_delayacct sysctl value
5
6If you have ever turned on the kernel.task_delayacct sysctl for the current
7Linux boot, then the heuristic that iotop uses to find out if swapin/io are
8available, gives a false negative, so the sysctl has to be checked too now.
9
10Origin: upstream, https://repo.or.cz/iotop.git/commit/ab35334d374e588bec12d201fb8869c536f0545d
11Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/iotop/+bug/1982727
12Last-Update: 2023-06-09
13---
14 iotop/data.py | 8 ++++++++
15 iotop/ui.py | 14 +++++++++++---
16 2 files changed, 19 insertions(+), 3 deletions(-)
17
18--- a/iotop/data.py
19+++ b/iotop/data.py
20@@ -471,3 +471,11 @@
21
22 def clear(self):
23 self.processes = {}
24+
25+
26+def sysctl_task_delayacct():
27+ try:
28+ with open('/proc/sys/kernel/task_delayacct') as f:
29+ return bool(int(f.read().strip()))
30+ except FileNotFoundError:
31+ return None
32--- a/iotop/ui.py
33+++ b/iotop/ui.py
34@@ -43,7 +43,7 @@
35
36 from collections import OrderedDict
37
38-from iotop.data import find_uids, TaskStatsNetlink, ProcessList, Stats
39+from iotop.data import find_uids, TaskStatsNetlink, ProcessList, Stats, sysctl_task_delayacct
40 from iotop.data import ThreadInfo
41 from iotop.version import VERSION
42 from iotop import ioprio
43@@ -421,7 +421,7 @@
44 def format(p):
45 stats = format_stats(self.options, p, self.process_list.duration)
46 io_delay, swapin_delay, read_bytes, write_bytes = stats
47- if Stats.has_blkio_delay_total:
48+ if self.has_swapin_io:
49 delay_stats = '%7s %7s ' % (swapin_delay, io_delay)
50 else:
51 delay_stats = ' ?unavailable? '
52@@ -473,6 +473,14 @@
53 pid += 'TID'
54 titles = [pid, ' PRIO', ' USER', ' DISK READ', ' DISK WRITE',
55 ' SWAPIN', ' IO', ' COMMAND']
56+ self.has_swapin_io = Stats.has_blkio_delay_total
57+ if self.has_swapin_io:
58+ # Linux kernels without the sysctl return None and
59+ # iotop just uses the heuristic for those versions.
60+ # Linux kernels with the sysctl return True or False
61+ # and iotop then uses the sysctl value instead.
62+ if sysctl_task_delayacct() == False:
63+ self.has_swapin_io = False
64 lines = self.get_data()
65 if self.options.time:
66 titles = [' TIME'] + titles
67@@ -491,7 +499,7 @@
68 else:
69 self.win.erase()
70
71- if Stats.has_blkio_delay_total:
72+ if self.has_swapin_io:
73 status_msg = None
74 else:
75 status_msg = ('CONFIG_TASK_DELAY_ACCT not enabled in kernel, '
diff --git a/debian/patches/series b/debian/patches/series
0new file mode 10064476new file mode 100644
index 0000000..9b35470
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
1lp1982727-config_task_delay_acct.patch

Subscribers

People subscribed via source and target branches