[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <t3h7ciq4vn3uqwfgroisfkrh7xymgr6hlnsgyutwi2azkbuhcz@yu5c4xyzi32f>
Date: Thu, 13 Mar 2025 16:19:40 +0100
From: Joel Granados <joel.granados@...nel.org>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: Ruiwu Chen <rwchen404@...il.com>, corbet@....net,
keescook@...omium.org, linux-doc@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, viro@...iv.linux.org.uk, zachwade.k@...il.com
Subject: Re: [PATCH v2] drop_caches: re-enable message after disabling
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@...il.com>
> > > >
> > > > 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.
>
> > And what does operate it twice mean?
>
> 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
Thx for the clarification.
I see what is happening:
Once you turn the message off, its off for ever because of the or.
Removing the "or" allows turning the message on off based on the 4th
bit.
I'll take your fix @Luis
Thx.
Best
>
> Luis
--
Joel Granados
Powered by blists - more mailing lists