Browse code

Checking whether CG_MEM_SWAP is enabled at the current system session

Signed-off-by: CUI Wei <ghostplant@qq.com>

cuiwei13 authored on 2016/11/21 11:27:04
Showing 1 changed files
... ...
@@ -217,9 +217,13 @@ echo 'Optional Features:'
217 217
 	check_flags CGROUP_PIDS
218 218
 }
219 219
 {
220
+	CODE=${EXITCODE}
220 221
 	check_flags MEMCG_SWAP MEMCG_SWAP_ENABLED
221
-	if  is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then
222
-		echo "    $(wrap_color '(note that cgroup swap accounting is not enabled in your kernel config, you can enable it by setting boot option "swapaccount=1")' bold black)"
222
+	if [ -e /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes ]; then
223
+		echo "    $(wrap_color '(cgroup swap accounting is currently enabled)' bold black)"
224
+		EXITCODE=${CODE}
225
+	elif is_set MEMCG_SWAP && ! is_set MEMCG_SWAP_ENABLED; then
226
+		echo "    $(wrap_color '(cgroup swap accounting is currently not enabled, you can enable it by setting boot option "swapaccount=1")' bold black)"
223 227
 	fi
224 228
 }
225 229