Bug#911746: zram-tools: Processor count is incorrect on some ARM boards

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug#911746: zram-tools: Processor count is incorrect on some ARM boards

Julian Calaby
Package: zram-tools
Version: 0.3.2-1
Severity: important

Dear Maintainer,

On some ARM boards, zramswap miscounts the processors due to not anchoring
the regex it uses to count processors.

For example /proc/cpuinfo on a Raspberry Pi looks like:

---

processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 897.37
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 0002
Serial          : 000000003ec63cb3

---

contains the word "processor" twice when there's only one processor.

To fix this, the regex used by grep on line 23 of zramswap needs to be
"^processor" instead of just "processor".

Alternatively replacing that line with some lscpu invocation punts the problem
of parsing /proc/cpuinfo to another package.

(Note that this was reported on my laptop as reportbug isn't available on the
affected board)

Thanks,

Julian Calaby


-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en_AU:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages zram-tools depends on:
ii  bc  1.07.1-2+b1

zram-tools recommends no packages.

zram-tools suggests no packages.

-- no debconf information

Reply | Threaded
Open this post in threaded view
|

Bug#911746: Since Kernel 3.15 device per core not needed

Stuart Naylor

Zram has supported streams since 3.15 and part from a history of bugs and the pointless nature of partitioning memory swap size via the reciprocal of cores and creating smaller swaps!
The biggest question is why.

Please stop copying existing bad scripts and please read the kernel doc.
https://www.kernel.org/doc/Documentation/blockdev/zram.txt

The worst bug is that the script makes zero check to see if any zram devices exist on start or exit.
I don’t think there is another precedent where something and so simple as checking for existing devices is missing in any package.
That is just the start of how flawed the methods are starting with how is it zram-tools when all it does is some bad illogical swaps?

Stuart

At least do a simple check that zram exists on start and use the hot_add system that zram uses for devices.

>if [ ! -d "/sys/class/zram-control" ]; then

>modprobe --verbose zram

>RAM_DEV='0'

>else

>RAM_DEV=$(cat /sys/class/zram-control/hot_add)

On unload if =$(cat /sys/class/zram-control/hot_add) <> 0 then devices exist.

https://github.com/StuartIanNaylor/zram-swap-config

https://github.com/StuartIanNaylor/zram-config

https://github.com/StuartIanNaylor/zramdrive

https://github.com/StuartIanNaylor/log2zram



 

Sent from Mail for Windows 10