lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 14 Feb 2023 10:22:20 +0100
From:   Paolo Abeni <pabeni@...hat.com>
To:     Pedro Tammela <pctammela@...atatu.com>, netdev@...r.kernel.org
Cc:     jhs@...atatu.com, xiyou.wangcong@...il.com, jiri@...nulli.us,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org
Subject: Re: [PATCH net-next 3/3] net/sched: act_gate: use percpu stats

On Fri, 2023-02-10 at 17:27 -0300, Pedro Tammela wrote:
> 
> diff --git a/net/sched/act_gate.c b/net/sched/act_gate.c
> index 9b8def0be..684b7a79f 100644
> --- a/net/sched/act_gate.c
> +++ b/net/sched/act_gate.c
> @@ -120,10 +120,10 @@ TC_INDIRECT_SCOPE int tcf_gate_act(struct sk_buff *skb,
>  {
>  	struct tcf_gate *gact = to_gate(a);
>  
> -	spin_lock(&gact->tcf_lock);
> -
>  	tcf_lastuse_update(&gact->tcf_tm);
> -	bstats_update(&gact->tcf_bstats, skb);
> +	tcf_action_update_bstats(&gact->common, skb);
> +
> +	spin_lock(&gact->tcf_lock);

I think that RCU-ifying the 'current_gate_status' field, setting its
value with  WRITE_ONCE (both in _init and in gate_timer_func()) and
finally accessing it here with READ_ONCE, you could move pretty much
everything except the code touching *_octets update outside the
spinlock.

I'm not sure how much that will be relevant - e.g. how frequently we
expect to hit the 

	if (gact->current_max_octets >= 0) {

code path.

For sure the current code allocates per_cpu stats, but they are never
used.

Cheers,

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ