Kernel commit 2d1c498072de69e (which made its way into kernel v5.8-rc1)
removed CONFIG_MEMCG_SWAP_ENABLED Kconfig option, making swap accounting
always enabled (unless swapaccount=0 boot option is provided).
Make the check conditional.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 070f9d9dd35e854f4a30563183987a6ec3276847)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -230,13 +230,21 @@ echo 'Optional Features:' |
| 230 | 230 |
check_flags CGROUP_PIDS |
| 231 | 231 |
} |
| 232 | 232 |
{
|
| 233 |
- CODE=${EXITCODE}
|
|
| 234 |
- check_flags MEMCG_SWAP MEMCG_SWAP_ENABLED |
|
| 235 |
- if [ -e /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes ]; then |
|
| 233 |
+ check_flags MEMCG_SWAP |
|
| 234 |
+ # Kernel v5.8+ removes MEMCG_SWAP_ENABLED. |
|
| 235 |
+ if [ "$kernelMajor" -lt 5 ] || [ "$kernelMajor" -eq 5 -a "$kernelMinor" -le 8 ]; then |
|
| 236 |
+ CODE=${EXITCODE}
|
|
| 237 |
+ check_flags MEMCG_SWAP_ENABLED |
|
| 238 |
+ # FIXME this check is cgroupv1-specific |
|
| 239 |
+ if [ -e /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes ]; then |
|
| 240 |
+ echo " $(wrap_color '(cgroup swap accounting is currently enabled)' bold black)" |
|
| 241 |
+ EXITCODE=${CODE}
|
|
| 242 |
+ elif is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then |
|
| 243 |
+ echo " $(wrap_color '(cgroup swap accounting is currently not enabled, you can enable it by setting boot option "swapaccount=1")' bold black)" |
|
| 244 |
+ fi |
|
| 245 |
+ else |
|
| 246 |
+ # Kernel v5.8+ enables swap accounting by default. |
|
| 236 | 247 |
echo " $(wrap_color '(cgroup swap accounting is currently enabled)' bold black)" |
| 237 |
- EXITCODE=${CODE}
|
|
| 238 |
- elif is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then |
|
| 239 |
- echo " $(wrap_color '(cgroup swap accounting is currently not enabled, you can enable it by setting boot option "swapaccount=1")' bold black)" |
|
| 240 | 248 |
fi |
| 241 | 249 |
} |
| 242 | 250 |
{
|