Public bug reported:

in sysfs.conf:
kernel/mm/transparent_hugepage/defrag = defer

After systemctl restart sysfsutils.service:

cat kernel/mm/transparent_hugepage/defrag
result: always defer [defer+madvise] madvise never

Problem seems to be related to lines 49-50 of /etc/init.d/sysfsutils, the use 
of echo -n followed by echo.
If you reverse them to do echo followed by echo -n then it applies correctly.

Example of "echo -n defer > defrag":
  Mythmaster  mattaw  ⋯  kernel  mm  transparent_hugepage  sudo dash -c 
"echo -n defer > defrag"
  Mythmaster  mattaw  ⋯  kernel  mm  transparent_hugepage  cat *
always defer [defer+madvise] madvise never
 - incorrect

Example of "echo defer > defrag":
  Mythmaster  mattaw  ⋯  kernel  mm  transparent_hugepage  sudo dash -c 
"echo defer > defrag"
  Mythmaster  mattaw  ⋯  kernel  mm  transparent_hugepage  cat *
always [defer] defer+madvise madvise never
 - correct

Note: this is a bug in the kernel handling of the defrag interface:
https://github.com/torvalds/linux/blob/v4.13/mm/huge_memory.c:
Lines 237-255 or so.
Test is memcmp between the input buffer and "defer+madvise", with a newline 
memcmp doesn't match. Without it matches:
        } else if (!memcmp("defer+madvise", buf,
                    min(sizeof("defer+madvise")-1, count))) {
will match either defer or defer+madvise. Unfortunate.

** Affects: sysfsutils (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1745780

Title:
  Setting from sysfs.conf incorrectly applied

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/sysfsutils/+bug/1745780/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to