lkml.org 
[lkml]   [2017]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@suse.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

\
 
 \ /
  Last update: 2017-11-09 08:51    [W:0.049 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site