Message ID | 20230327084011.1062770-2-amorenoz@redhat.com |
---|---|
State | Accepted |
Commit | 79f936744916cfbc6952308d33012c994eb274de |
Headers | show |
Series | Fix number or handler calculation in corner cases | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/intel-ovs-compilation | success | test: success |
On Mon, Mar 27, 2023 at 4:40 AM Adrian Moreno <amorenoz@redhat.com> wrote: > > Ensure at least 1 handler is created even if something goes wrong during > cpu detection or prime numer calculation. > > Fixes: a5cacea5f988 ("handlers: Create additional handler threads when using CPU isolation.") > Cc: msantana@redhat.com > > Suggested-by: Aaron Conole <aconole@redhat.com> > Signed-off-by: Adrian Moreno <amorenoz@redhat.com> I didn't test this, but it seems reasonable to me that we prevent the creation of zero threads. Acked-by: Mike Pattrick <mkp@redhat.com>
On 3/27/23 04:40, Adrian Moreno wrote: > Ensure at least 1 handler is created even if something goes wrong during > cpu detection or prime numer calculation. Thanks Adrian for the fix. This should have been in my initial patch series as it serves as a nice catch-all in case anything (such as this case) goes wrong > > Fixes: a5cacea5f988 ("handlers: Create additional handler threads when using CPU isolation.") > Cc: msantana@redhat.com > > Suggested-by: Aaron Conole <aconole@redhat.com> > Signed-off-by: Adrian Moreno <amorenoz@redhat.com> Acked-by: Michael Santana <msantana@redhat.com> > --- > lib/dpif-netlink.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c > index 7875e573e..ebe7b5cb1 100644 > --- a/lib/dpif-netlink.c > +++ b/lib/dpif-netlink.c > @@ -2582,7 +2582,7 @@ dpif_netlink_calculate_n_handlers(void) > n_handlers = MIN(next_prime_num, total_cores); > } > > - return n_handlers; > + return MAX(n_handlers, 1); > } > > static int
diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c index 7875e573e..ebe7b5cb1 100644 --- a/lib/dpif-netlink.c +++ b/lib/dpif-netlink.c @@ -2582,7 +2582,7 @@ dpif_netlink_calculate_n_handlers(void) n_handlers = MIN(next_prime_num, total_cores); } - return n_handlers; + return MAX(n_handlers, 1); } static int
Ensure at least 1 handler is created even if something goes wrong during cpu detection or prime numer calculation. Fixes: a5cacea5f988 ("handlers: Create additional handler threads when using CPU isolation.") Cc: msantana@redhat.com Suggested-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Adrian Moreno <amorenoz@redhat.com> --- lib/dpif-netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)