[Devel] [RFC rh7] ve/vznetstat: Move VE networks statistics allocation into a commaon place

Cyrill Gorcunov gorcunov at virtuozzo.com
Mon Jul 20 06:04:48 PDT 2015


On Mon, Jul 20, 2015 at 03:55:18PM +0300, Andrew Vagin wrote:
> On Sat, Jul 18, 2015 at 10:40:23AM +0300, Cyrill Gorcunov wrote:
> > +
> > +static void __exit __exit_venetstat(void)
> > +{
> > +	struct ve_struct *ve;
> > +
> > +	mutex_lock(&ve_list_lock);
> > +	for_each_ve(ve) {
> > +		venet_acct_put_stat(ve->stat);
> > +		ve->stat = NULL;
> > +	}
> > +	mutex_unlock(&ve_list_lock);
> > +
> 
> venet_acct_hook can be called in this moment. I think we need to
> unregister the hook before the previous loop.

Thanks! Same applies to init state I suppose? (module
get loaded. we allocate all stats for existing VEs, then
unlock ve_list_lock and register the hook, so there is
a small window where new VE can be created and run
without stat allocation). Gonna address it too.
Thanks!

> 
> > +	ve_hook_unregister(&venet_acct_hook);
> > +}
> >  
> >  int __init venetstat_init(void)
> >  {
> > @@ -1095,6 +1156,10 @@ int __init venetstat_init(void)
> >  	for (i = 0; i < STAT_HASH_LEN; i++)
> >  		INIT_LIST_HEAD(stat_hash_list + i);
> >  
> > +	i = __init_venetstat();
> > +	if (i)
> > +		return i;
> 
> This looks ugly. Could you declare one more variable with more suitable
> name.

sure



More information about the Devel mailing list