[PATCH 0/2][RFC] Makes sd->flags sysctl writable

From: Chen Yu
Date: Mon Jul 06 2020 - 15:35:15 EST


It was found that recently the flags of sched domain could
not be customized via sysctl, which might make it a little
inconenient for performance tuning/debugging.

echo 343 > /proc/sys/kernel/sched_domain/cpu0/domain0/flags
bash: flags: Permission denied

343 stands for:
(SD_BALANCE_NEWIDLE SD_BALANCE_EXEC SD_BALANCE_FORK SD_WAKE_AFFINE)

As mentioned in Commit 9818427c6270 ("sched/debug: Make sd->flags
sysctl read-only"), the flags field is made read-only, due to the
concerns that the sd flags and the per cpu cache domain pointer are
not coherent.

This trial patch tries to address the issue by updating the cache
domain pointer once the flag has been modified. So that the sd->flags
could be changed via sysctl.

I'm not sure if there is other purpose that we've set the flags to
read-only, but it seems that keeping the sd->flags writable could
help diagnose the system easier. Any comment would be appreciated.

Chen Yu (2):
sched/topology: Add update_domain_cpu()
sched/debug: Make sd->flags sysctl writable again

include/linux/sched/topology.h | 5 +++++
kernel/sched/debug.c | 30 +++++++++++++++++++++++++++---
kernel/sched/topology.c | 11 +++++++++++
3 files changed, 43 insertions(+), 3 deletions(-)

--
2.17.1