From 93ee04e53f575530feb41827d95c86f808efa2f5 Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Thu, 9 Feb 2017 10:29:38 +0000 Subject: Replace a custom loop calling yield() by the idiom to check if the current process is hogging a CPU. ok mikeb@, visa@, tedu@ --- sys/net/pf_table.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'sys/net') diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c index 6cf6c45babb..e26589d9bc9 100644 --- a/sys/net/pf_table.c +++ b/sys/net/pf_table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_table.c,v 1.123 2017/01/24 10:08:30 krw Exp $ */ +/* $OpenBSD: pf_table.c,v 1.124 2017/02/09 10:29:37 mpi Exp $ */ /* * Copyright (c) 2002 Cedric Berger @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -72,11 +73,8 @@ (bcopy((from), (to), (size)), 0)) #define YIELD(cnt, ok) \ - do { \ - if ((cnt % 1024 == 1023) && \ - (ok)) \ - yield(); \ - } while (0) + if (curcpu()->ci_schedstate.spc_schedflags & SPCF_SHOULDYIELD) \ + preempt(NULL) \ #define FILLIN_SIN(sin, addr) \ do { \ -- cgit v1.2.3