[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171109075016.ufgjvegqghjus3wc@dhcp22.suse.cz>
Date: Thu, 9 Nov 2017 08:50:16 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: Vlastimil Babka <vbabka@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Dave Hansen <dave.hansen@...el.com>,
Ying Huang <ying.huang@...el.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm, vmstat: Make sure mutex is a global static
On Wed 08-11-17 07:21:20, Kees Cook wrote:
> On Tue, Nov 7, 2017 at 11:43 PM, Vlastimil Babka <vbabka@...e.cz> wrote:
> > On 11/07/2017 10:38 PM, Kees Cook wrote:
[...]
> >> +static DEFINE_MUTEX(vm_numa_stat_lock);
> >> +
> >> int sysctl_vm_numa_stat_handler(struct ctl_table *table, int write,
> >> void __user *buffer, size_t *length, loff_t *ppos)
> >> {
> >> int ret, oldval;
> >> - DEFINE_MUTEX(vm_numa_stat_lock);
> >
> > Yeah it was Michal who suggested scoping the mutex here instead of
> > global scope, but I think he didn't mean to remove the 'static'
> > qualifier, and we both missed that in the review :(
> > So the scope under sysctl_vm_numa_stat_handler() should be okay, just
> > with the 'static' added.
>
> That part is a matter of taste, I guess. :) But yes, static is important.
The primary reason I prefer function scope lock is that it is less
tempting to reuse the lock for something else that way. But this is
hardly something to insist on. So I am ok with the file scope as well.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists