Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-27 Thread Alexandr Nedvedicky
Hello, Hello, On Thu, Apr 27, 2023 at 10:41:53AM +1000, David Gwynne wrote: > > t could be NULL here. just do the unit check inside the loop? > > > > > if (t->pft_unit != unit) > > return (NULL); > > > > return (t); > > } > > > > just return NULL on unit

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-26 Thread David Gwynne
On Wed, Apr 26, 2023 at 11:45:08PM +0200, Alexandr Nedvedicky wrote: > Hello, > > On Thu, Apr 27, 2023 at 06:51:52AM +1000, David Gwynne wrote: > > > > is that kind of check in KASSET() something you have on your mind? > > > perhaps I can trade KASSERT() to regular code: > > > > > >

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-26 Thread Alexandr Nedvedicky
Hello, On Thu, Apr 27, 2023 at 06:51:52AM +1000, David Gwynne wrote: > > is that kind of check in KASSET() something you have on your mind? > > perhaps I can trade KASSERT() to regular code: > > > > if (t->pft_unit != minor(dev)) > > return (EPERM); > > i would pass the

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-26 Thread David Gwynne
On Wed, Apr 26, 2023 at 01:47:31PM +0200, Alexandr Nedvedicky wrote: > Hello, > > > On Wed, Apr 26, 2023 at 11:37:58AM +1000, David Gwynne wrote: > > > fail: > > > - if (flags & FWRITE) > > > - rw_exit_write(_rw); > > > - else > > > - rw_exit_read(_rw); > > > +

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-26 Thread Alexandr Nedvedicky
Hello, On Wed, Apr 26, 2023 at 11:51:26AM +, Gerhard Roth wrote: > On Wed, 2023-04-26 at 13:47 +0200, Alexandr Nedvedicky wrote: > > @@ -293,6 +300,28 @@ pfopen(dev_t dev, int flags, int fmt, struct proc *p) > > ??int > > ??pfclose(dev_t dev, int flags, int fmt, struct proc *p) > > ??{ > >

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-26 Thread Gerhard Roth
On Wed, 2023-04-26 at 13:47 +0200, Alexandr Nedvedicky wrote: > Hello, > > > On Wed, Apr 26, 2023 at 11:37:58AM +1000, David Gwynne wrote: > > >  fail: > > > -   if (flags & FWRITE) > > > -   rw_exit_write(_rw); > > > -   else > > > -   rw_exit_read(_rw); > > > +  

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-26 Thread Alexandr Nedvedicky
Hello, On Wed, Apr 26, 2023 at 11:37:58AM +1000, David Gwynne wrote: > > fail: > > - if (flags & FWRITE) > > - rw_exit_write(_rw); > > - else > > - rw_exit_read(_rw); > > + rw_exit_write(_rw); > > i dont think having the open mode flags affect whether you take a

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-26 Thread David Gwynne
On Wed, Apr 26, 2023 at 09:49:18AM +, Gerhard Roth wrote: > On Wed, 2023-04-26 at 19:42 +1000, David Gwynne wrote: > > On Wed, Apr 26, 2023 at 07:48:18AM +, Gerhard Roth wrote: > > > On Wed, 2023-04-26 at 00:39 +0200, Alexandr Nedvedicky wrote: > > > > Hello, > > > > > > > > This is the

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-26 Thread Gerhard Roth
On Wed, 2023-04-26 at 19:42 +1000, David Gwynne wrote: > On Wed, Apr 26, 2023 at 07:48:18AM +, Gerhard Roth wrote: > > On Wed, 2023-04-26 at 00:39 +0200, Alexandr Nedvedicky wrote: > > > Hello, > > > > > > This is the second diff. It introduces a transaction (pf_trans). > > > It's more or

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-26 Thread David Gwynne
On Wed, Apr 26, 2023 at 07:48:18AM +, Gerhard Roth wrote: > On Wed, 2023-04-26 at 00:39 +0200, Alexandr Nedvedicky wrote: > > Hello, > > > > This is the second diff. It introduces a transaction (pf_trans). > > It's more or less diff with dead code. > > > > It's still worth to note those two

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-26 Thread Gerhard Roth
On Wed, 2023-04-26 at 00:39 +0200, Alexandr Nedvedicky wrote: > Hello, > > This is the second diff. It introduces a transaction (pf_trans). > It's more or less diff with dead code. > > It's still worth to note those two chunks in this diff: > > @@ -1142,10 +1172,7 @@ pfioctl(dev_t dev, u_long

Re: DIOCGETRULE is slow for large rulesets (2/3)

2023-04-25 Thread David Gwynne
On Wed, Apr 26, 2023 at 12:39:00AM +0200, Alexandr Nedvedicky wrote: > Hello, > > This is the second diff. It introduces a transaction (pf_trans). > It's more or less diff with dead code. > > It's still worth to note those two chunks in this diff: > > @@ -1142,10 +1172,7 @@ pfioctl(dev_t dev,

DIOCGETRULE is slow for large rulesets (2/3)

2023-04-25 Thread Alexandr Nedvedicky
Hello, This is the second diff. It introduces a transaction (pf_trans). It's more or less diff with dead code. It's still worth to note those two chunks in this diff: @@ -1142,10 +1172,7 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) return