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

Subscribers

People subscribed via source and target branches