Vivien Didelot
2019-Dec-10 20:34 UTC
[Bridge] [PATCH net-next] net: bridge: add STP xstats
On Tue, 10 Dec 2019 22:15:26 +0200, Nikolay Aleksandrov <nikolay at cumulusnetworks.com> wrote:> >>>> Why do you need percpu ? All of these seem to be incremented with the > >>>> bridge lock held. A few more comments below. > >>> > >>> All other xstats are incremented percpu, I simply followed the pattern. > >>> > >> > >> We have already a lock, we can use it and avoid the whole per-cpu memory handling. > >> It seems to be acquired in all cases where these counters need to be changed. > > > > Since the other xstats counters are currently implemented this way, I prefer > > to keep the code as is, until we eventually change them all if percpu is in > > fact not needed anymore. > > > > The new series is ready and I can submit it now if there's no objection. > > There is a reason other counters use per-cpu - they're incremented without any locking from fast-path. > The bridge STP code already has a lock which is acquired in all of these paths and we don't need > this overhead and the per-cpu memory allocations. Unless you can find a STP codepath which actually > needs per-cpu, I'd prefer you drop it.Ho ok I understand what you mean now. I'll drop the percpu attribute. Thanks, Vivien
Nikolay Aleksandrov
2019-Dec-10 20:52 UTC
[Bridge] [PATCH net-next] net: bridge: add STP xstats
On 10/12/2019 22:34, Vivien Didelot wrote:> On Tue, 10 Dec 2019 22:15:26 +0200, Nikolay Aleksandrov <nikolay at cumulusnetworks.com> wrote: >>>>>> Why do you need percpu ? All of these seem to be incremented with the >>>>>> bridge lock held. A few more comments below. >>>>> >>>>> All other xstats are incremented percpu, I simply followed the pattern. >>>>> >>>> >>>> We have already a lock, we can use it and avoid the whole per-cpu memory handling. >>>> It seems to be acquired in all cases where these counters need to be changed. >>> >>> Since the other xstats counters are currently implemented this way, I prefer >>> to keep the code as is, until we eventually change them all if percpu is in >>> fact not needed anymore. >>> >>> The new series is ready and I can submit it now if there's no objection. >> >> There is a reason other counters use per-cpu - they're incremented without any locking from fast-path. >> The bridge STP code already has a lock which is acquired in all of these paths and we don't need >> this overhead and the per-cpu memory allocations. Unless you can find a STP codepath which actually >> needs per-cpu, I'd prefer you drop it. > > Ho ok I understand what you mean now. I'll drop the percpu attribute. > > > Thanks, > > Vivien >Great, thanks again. I think it's clear, but I'll add just in case to avoid extra work - you can drop the dynamic memory allocation altogether and make the struct part of net_bridge_port. Cheers, Nik