• Dmitry Safonov's avatar
    cgroup: Handle multiline properties in restore_cgroup_prop() · 610e1536
    Dmitry Safonov authored
    We need to write some multiline properties line-by-line,
    instead of writing all buffer at once - because kernel doesn't
    support parsing them in one write().
    
    Previously, it was done for devices.allow list, but I need it
    also for netprio.ifpriomap. To make easier reusing this code,
    add split_lines parameter to restore_cgroup_prop().
    
    Dropping next_device_entry() and multiply calls to
    restore_cgroup_prop() also improves performance: previously
    for each property's line, cgroup file was re-open() and close()
    again, while new code only calls write() for each line, reducing
    number of syscalls done for each line.
    
    This also makes it suitable for future:
    if patch(s) for parsing all lines of property with one write()
    would be accepted, then we can easily change call to something:
    restore_cgroup_prop(&dev_allow, paux, off, !kdat.cgroup_multiline_write);
    
    We can even use split_lines = true by default for all cases,
    as strchrnul() will only find zero-terminator as does strlen().
    But I don't want to do it - if there are cgroup files which
    supportes multi-line write(), it'll add syscalls.
    Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
    Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
    610e1536
Name
Last commit
Last update
Documentation Loading commit data...
compel Loading commit data...
contrib Loading commit data...
coredump Loading commit data...
crit Loading commit data...
criu Loading commit data...
images Loading commit data...
include/common Loading commit data...
lib Loading commit data...
scripts Loading commit data...
soccr Loading commit data...
test Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
.travis.yml Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
INSTALL.md Loading commit data...
Makefile Loading commit data...
Makefile.compel Loading commit data...
Makefile.config Loading commit data...
Makefile.install Loading commit data...
Makefile.versions Loading commit data...
README.md Loading commit data...