[Devel] [PATCH rh7] ve/net: allow to change max number of net devices for running CT

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri Mar 1 17:57:29 MSK 2019


Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

On 3/1/19 5:33 PM, Konstantin Khorenko wrote:
> If a Container hits "ve::netif_max_nr", we want to fix the situation by
> increasing the limit without a Container restart, so allow this.
> 
> Note: too low value set can turn "ve::netif_avail_nr" to negative,
> that's OK, the code is ready for that.
> 
> https://jira.sw.ru/browse/PSBM-92132
> 
> Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
> ---
>   kernel/ve/ve.c | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
> index 37c65c93abef..f1aef51f8bd5 100644
> --- a/kernel/ve/ve.c
> +++ b/kernel/ve/ve.c
> @@ -1307,7 +1307,12 @@ static u64 ve_read_u64(struct cgroup *cg, struct cftype *cft)
>   		return atomic_read(&cgroup_ve(cg)->netns_avail_nr);
>   	else if (cft->private == VE_CF_NETIF_MAX_NR)
>   		return cgroup_ve(cg)->netif_max_nr;
> -	else if (cft->private == VE_CF_NETIF_NR)
> +	return 0;
> +}
> +
> +static s64 ve_read_s64(struct cgroup *cg, struct cftype *cft)
> +{
> +	if (cft->private == VE_CF_NETIF_NR)
>   		return atomic_read(&cgroup_ve(cg)->netif_avail_nr);
>   	return 0;
>   }
> @@ -1598,12 +1603,12 @@ static struct cftype ve_cftypes[] = {
>   		.name			= "netif_max_nr",
>   		.flags			= CFTYPE_NOT_ON_ROOT,
>   		.read_u64		= ve_read_u64,
> -		.write_u64		= ve_write_u64,
> +		.write_u64		= ve_write_running_u64,
>   		.private		= VE_CF_NETIF_MAX_NR,
>   	},
>   	{
>   		.name			= "netif_avail_nr",
> -		.read_u64		= ve_read_u64,
> +		.read_s64		= ve_read_s64,
>   		.private		= VE_CF_NETIF_NR,
>   	},
>   	{
> 

-- 
Best regards, Tikhomirov Pavel
Software Developer, Virtuozzo.



More information about the Devel mailing list