On Tue, Jan 21, 2025 at 07:17:15PM +0800, Huang, Ying wrote: ... snip ... > > Unless it's possible we will add more modes in the future, this is kind > of overkill for me. How about something simpler as below? > > $ cat auto > true > $ echo 0 > auto > $ cat auto > false We have discussed having a dynamic-mode where the weights might adjust on the fly based on system-state, but i think this ends up being controlled under mempolicy/dynamic_interleave or something. So this seems reasonable. > > static u8 __rcu *iw_table; > > static DEFINE_MUTEX(iw_table_lock); > > +static const int weightiness = 32; > > +static bool weighted_interleave_auto = true; > > I still prefer to use 2 iw_table, one is for default, the other is for > manual. The default one will be used if the manual one is NULL. Both > are protected by RCU. The default one can be updated upon hotplug > blindly. This makes the whole model easier to be understood IMHO. > > What do you think about that. > only question is, lets say you have `cat auto node0 node1` -> `true 5 1` and you do echo 0 > auto what should a subsequent `cat auto node0 node1` output? `false 5 1` or `false 1 1` Then lets say we do echo 7 > node0 what should echo true > auto result in? `true 5 1` or `true 7 1` The current code makes sure that when you switch modes from auto to manual, it inherits the current state - instead of there being some hidden state that suddenly takes precedence. So I prefer to just have one IW array and no hidden state. ~Gregory