Hello,
On Wed, Jun 16, 2021 at 02:19:24PM +1000, David Gwynne wrote:
>
>
> > On 14 Jun 2021, at 19:12, Alexandr Nedvedicky
> > <[email protected]> wrote:
> >
> > Hello,
> >
> > looks good to me. I think this should be committed
> > as-is. I have just one question,
> >
> > On Mon, Jun 14, 2021 at 01:58:06PM +1000, David Gwynne wrote:
> > </snip>
> >> @@ -1931,6 +1933,9 @@ pfsync_defer(struct pf_state *st, struct
> >> {
> >> struct pfsync_softc *sc = pfsyncif;
> >> struct pfsync_deferral *pd;
> >> + struct timeval now;
> >> + unsigned int sched;
> >> + static const struct timeval defer = { 0, 20000 };
> > ^^^^^^^
> > I'm just curious, why there is a static?
>
> so it can exist in the ro data section rather than get set up on the stack
> every call.
>
I see. Thanks for clarifying. I took a closer look at how `defer`
is being used in pfsync_defer():
timeradd(&now, &defer, &pd->pd_deadline);
yes, it makes sense to put the `defer` constant to ro data section,
so it does not need to be allocated on a stack with every call to
pfsync_defer().
thanks and
regards
sashan