All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Zickus <dzickus@redhat.com>
To: Michal Hocko <mhocko@suse.cz>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [RFC 1/2] watchdog: update watchdog attributes atomically
Date: Tue, 23 Jul 2013 09:56:22 -0400	[thread overview]
Message-ID: <20130723135622.GG126784@redhat.com> (raw)
In-Reply-To: <20130719163323.GB9759@dhcp22.suse.cz>

On Fri, Jul 19, 2013 at 06:33:23PM +0200, Michal Hocko wrote:
> On Fri 19-07-13 12:10:48, Don Zickus wrote:
> > On Fri, Jul 19, 2013 at 11:04:58AM +0200, Michal Hocko wrote:
> > > proc_dowatchdog doesn't synchronize multiple callers which
> > > might lead to confusion when two parallel callers might confuse
> > > watchdog_enable_all_cpus resp. watchdog_disable_all_cpus (e.g. watchdog
> > > gets enabled even if watchdog_thresh was set to 0 already).
> > > 
> > > This patch adds a local mutex which synchronizes callers to the sysctl
> > > handler.
> > 
> > Looks fine by me, except one little nitpick..
> > 
> > > 
> > > Signed-off-by: Michal Hocko <mhocko@suse.cz>
> > > ---
> > >  kernel/watchdog.c | 7 +++++--
> > >  1 file changed, 5 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> > > index 1241d8c..2d64c02 100644
> > > --- a/kernel/watchdog.c
> > > +++ b/kernel/watchdog.c
> > > @@ -520,13 +520,15 @@ int proc_dowatchdog(struct ctl_table *table, int write,
> > >  		    void __user *buffer, size_t *lenp, loff_t *ppos)
> > >  {
> > >  	int err, old_thresh, old_enabled;
> > > +	static DEFINE_MUTEX(watchdog_proc_mutex);
> > 
> > Should we just make this global instead of hiding it as a static inside a
> > function.  I don't know the kernel rules for deciding which approach makes
> > sense.  I know it is the same result in either case...
> 
> I've hidden it into the function to discourage from abusing it for
> something else and because the usage is nicely focused in this
> function. But I have no problem to pull it out.

I understand what you are saying.  I just remember in the past being asked
not to do that, which is why I had the question.  I guess we can leave it
as is.

Cheers,
Don

      reply	other threads:[~2013-07-23 13:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19  9:04 [RFC 1/2] watchdog: update watchdog attributes atomically Michal Hocko
2013-07-19  9:04 ` [RFC 2/2] watchdog: update watchdog_tresh properly Michal Hocko
2013-07-19 16:08   ` Don Zickus
2013-07-19 16:37     ` Michal Hocko
2013-07-19 18:05       ` Don Zickus
2013-07-20  8:42         ` Michal Hocko
2013-07-22 11:45   ` [RFC -v2 " Michal Hocko
2013-07-22 12:47     ` Michal Hocko
2013-07-22 14:32     ` [RFC -v3 " Michal Hocko
2013-07-23 13:53       ` Don Zickus
2013-07-23 14:07         ` Michal Hocko
2013-07-23 14:44           ` Don Zickus
2013-07-23 14:51             ` Michal Hocko
2013-07-19 16:10 ` [RFC 1/2] watchdog: update watchdog attributes atomically Don Zickus
2013-07-19 16:33   ` Michal Hocko
2013-07-23 13:56     ` Don Zickus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130723135622.GG126784@redhat.com \
    --to=dzickus@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.