@@ -125,7 +125,7 @@ struct ctl_table
} __randomize_layout;
/**
- * enum ctl_table_flags - flags for the ctl table
+ * enum ctl_table_flags - flags for the ctl table (struct ctl_table.flags)
*
* @CTL_FLAGS_CLAMP_RANGE: Set to indicate that the entry should be
* flexibly clamped to min/max range in case the user provided
@@ -134,10 +134,23 @@ struct ctl_table
* had been issued for that entry.
*
* At most 16 different flags will be allowed.
+ *
+ * The flags can be set in two different ways. They can either be
+ * statically set at definition time or dynamically set at run time.
+ *
+ * Currently, only the CTL_FLAGS_OOR_WARNED flag is set at run time.
+ * No locking or atomic access to set @CTL_FLAGS_OOR_WARNED is needed
+ * in the current use case. If similar dynamic flags are defined in the
+ * future, we may need to revisit again to see if atomic access or
+ * locking is needed to prevent lost changes due to concurrent updates
+ * to the flags field.
*/
enum ctl_table_flags {
+ /* Statically set flags */
CTL_FLAGS_CLAMP_RANGE = BIT(0),
- CTL_FLAGS_OOR_WARNED = BIT(1),
+
+ /* Flags set at run time */
+ CTL_FLAGS_OOR_WARNED = BIT(8),
};
struct ctl_node {
Additional comments are added to clarify how the ctl_table.flags field should be set as well as precaution on what needs to be done when additional flags are defined in the future. Signed-off-by: Waiman Long <longman@redhat.com> --- include/linux/sysctl.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)