lkml.org 
[lkml]   [2018]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/5] sysctl: Clarify how the ctl_table.flags should be set
Date
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(-)

diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 3db57af..bc09361 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -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 {
--
1.8.3.1
\
 
 \ /
  Last update: 2018-03-07 21:37    [W:0.053 / U:12.024 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site