Re: [Devel] [PATCH vz7 v2 6/7] ub stat: sync memcg contents with beancounter if required

2015-10-02 Thread Vladimir Davydov
On Thu, Oct 01, 2015 at 05:38:43PM +0400, Stanislav Kinsburskiy wrote:

> @@ -224,6 +224,22 @@ int ubstat_alloc_store(struct user_beancounter *ub)
>  }
>  EXPORT_SYMBOL(ubstat_alloc_store);
>  
> +static bool ubstat_need_memcg_sync(long cmd)
> +{
> + if (UBSTAT_CMD(cmd) != UBSTAT_READ_ONE)
> + return true;
> +
> + switch (UBSTAT_PARMID(cmd)) {
> + case UB_KMEMSIZE:
> + case UB_DCACHESIZE:
> + case UB_PHYSPAGES:
> + case UB_SWAPPAGES:
> + case UB_OOMGUARPAGES:
> + return true;
> + }
> + return false;
> +}
> +
>  static int ubstat_check_cmd(long cmd)
>  {
>   switch (UBSTAT_CMD(cmd)) {
> @@ -255,6 +271,9 @@ static int ubstat_get_stat(struct user_beancounter *ub, 
> long cmd,
>   if (retval)
>   goto out;
>  
> + if (ubstat_need_memcg_sync(cmd))
> + ub_sync_memcg(ub);
> +

May be, just call ub_sync_memcg() unconditionally? It's not that heavy,
besides ubstat is a part of the legacy API, so why overcomplicate?

>   spin_lock(_notify_lock);
>   switch (UBSTAT_CMD(cmd)) {
>   case UBSTAT_READ_ONE:
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


Re: [Devel] [PATCH vz7 v2 6/7] ub stat: sync memcg contents with beancounter if required

2015-10-02 Thread Vladimir Davydov
On Fri, Oct 02, 2015 at 08:54:24PM +0200, Stanislav Kinsburskiу wrote:
> 
> 2 окт. 2015 г. 19:56 пользователь Vladimir Davydov  
> написал:
> >
> > On Thu, Oct 01, 2015 at 05:38:43PM +0400, Stanislav Kinsburskiy wrote: 
> >
> > > @@ -224,6 +224,22 @@ int ubstat_alloc_store(struct user_beancounter *ub) 
> > >  } 
> > >  EXPORT_SYMBOL(ubstat_alloc_store); 
> > >  
> > > +static bool ubstat_need_memcg_sync(long cmd) 
> > > +{ 
> > > + if (UBSTAT_CMD(cmd) != UBSTAT_READ_ONE) 
> > > + return true; 
> > > + 
> > > + switch (UBSTAT_PARMID(cmd)) { 
> > > + case UB_KMEMSIZE: 
> > > + case UB_DCACHESIZE: 
> > > + case UB_PHYSPAGES: 
> > > + case UB_SWAPPAGES: 
> > > + case UB_OOMGUARPAGES: 
> > > + return true; 
> > > + } 
> > > + return false; 
> > > +} 
> > > + 
> > >  static int ubstat_check_cmd(long cmd) 
> > >  { 
> > >  switch (UBSTAT_CMD(cmd)) { 
> > > @@ -255,6 +271,9 @@ static int ubstat_get_stat(struct user_beancounter 
> > > *ub, long cmd, 
> > >  if (retval) 
> > >  goto out; 
> > >  
> > > + if (ubstat_need_memcg_sync(cmd)) 
> > > + ub_sync_memcg(ub); 
> > > + 
> >
> > May be, just call ub_sync_memcg() unconditionally? It's not that heavy, 
> > besides ubstat is a part of the legacy API, so why overcomplicate? 
> 
> Just because I wanted to. And legacy API allows to do so.
> I don't insist, actually. But resending the series it's something I want even 
> less...

OK, since this code is doomed to die anyway, I won't insist.
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel