> On Wed, Mar 12, 2025 at 03:55:22PM -0700, Luis Chamberlain wrote: > > On Mon, Mar 10, 2025 at 02:51:11PM +0100, Joel Granados wrote: > > > On Sat, Mar 08, 2025 at 04:05:49PM +0800, Ruiwu Chen wrote: > > > > >> When 'echo 4 > /proc/sys/vm/drop_caches' the message is disabled, > > > > >> but there is no interface to enable the message, only by restarting > > > > >> the way, so add the 'echo 0 > /proc/sys/vm/drop_caches' way to > > > > >> enabled the message again. > > > > >> > > > > >> Signed-off-by: Ruiwu Chen <rwchen404@xxxxxxxxx> > > > > > > > > > > You are overcomplicating things, if you just want to re-enable messages > > > > > you can just use: > > > > > > > > > > - stfu |= sysctl_drop_caches & 4; > > > > > + stfu = sysctl_drop_caches & 4; > > > > > > > > > > The bool is there as 4 is intended as a bit flag, you can can figure > > > > > out what values you want and just append 4 to it to get the expected > > > > > result. > > > > > > > > > > Luis > > > > > > > > Is that what you mean ? > > > > > > > > - stfu |= sysctl_drop_caches & 4; > > > > + stfu ^= sysctl_drop_caches & 4; > > > > > > > > 'echo 4 > /sys/kernel/vm/drop_caches' can disable or open messages, > > > > This is what I originally thought, but there is uncertainty that when different operators execute the command, > > > > It is not possible to determine whether this time is enabled or turned on unless you operate it twice. > > > > > > So can you use ^= or not? > > > > No, ^= does not work, see a boolean truth table. I don't quite agree with you, you change this, echo {1,2,3} will have the meaning of enable message The initial logic: echo 1: free pagecache echo 2: free slab echo 3: free pagecache and slab echo 4: disable message If you change it to something like this: stfu = sysctl_drop_caches & 4; echo 1: free pagecache and enable message echo 2: free slab and enable message echo 3: free pagecache and enable message echo 4: disable message echo 4 becomes meaningless, when echo 4 only the next message can be disabled Unable to continuously disable echo{1,2,3} echo {1,2,3} always enabled the message echo {1,2,3} should not have the meaning of enabling messages My thoughts: stfu ^= !!(sysctl_drop_caches & 4); echo 1: free pagecache echo 2: free slab echo 3: free pagecache echo 4: disable message(odd-numbered operation), enable message(even-numbered operation) {1, 2, 3} & 4 = 0 stfu ^ 0 = stfu when echo{1, 2, 3} the stfu is not affected 0 ^ 1 = 1 echo 4: disable message(odd-numbered operation) 1 ^ 1 = 0 echo 4: enable message(even-numbered operation) stfu ^ 1 = !stfu when echo 4 stfu(0) -> stfu(1) -> stfu(0) -> stfu(1) -> stfu(0) -> ... > > > > > And what does operate it twice mean? echo 4 can: stfu = 1 # turn off stfu = 0 # turn on stfu = 1 # turn off stfu = 0 # turn on ... > > > > I think the reporter meant an "sysadmin", say two folks admining a system. > > Since we this as a flag to enable disabling it easily we can just > > always check for the flag as I suggested: > > > > stfu = sysctl_drop_caches & 4 > I sent out a new version of this patch. Its a bit late to push it though > the next merge window, so it is in sysctl-testing until the next cycle > > Thx again > > Best > > -- > > Joel Granados Ruiwu