Re: [PATCH] mm, vmstat: Make sure mutex is a global static

From: Michal Hocko
Date: Wed Nov 08 2017 - 09:20:51 EST


On Wed 08-11-17 08:43:44, Vlastimil Babka 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.

exactly! Sorry that I've missed the missing static and thanks for
catching that Kees.

--
Michal Hocko
SUSE Labs