Skip to content

Commit 53998ad

Browse files
committed
Change export worker schedule strategy.
1 parent 42799f6 commit 53998ad

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

ipt_NETFLOW.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -373,17 +373,15 @@ static inline int mask2bits(__be32 mask) {
373373
static DEFINE_MUTEX(worker_lock);
374374

375375
static int worker_delay = HZ / 10;
376-
static inline void _schedule_scan_worker(const int status)
376+
static inline void _schedule_scan_worker(const int pdus)
377377
{
378378
int cpu = exportcpu;
379379

380380
/* rudimentary congestion avoidance */
381-
if (status > 0)
382-
worker_delay -= status;
383-
else if (status < 0)
384-
worker_delay /= 2;
381+
if (pdus > 0)
382+
worker_delay /= pdus;
385383
else
386-
worker_delay++;
384+
worker_delay *= 2;
387385

388386
if (worker_delay < scan_min)
389387
worker_delay = scan_min;
@@ -3795,7 +3793,7 @@ static inline int active_needs_export(const struct ipt_netflow *nf, const long a
37953793

37963794
/* could be called with zero to flush cache and pdu */
37973795
/* this function is guaranteed to be called non-concurrently */
3798-
/* return -1 is trylockfailed, 0 if nothin gexported, >=1 if exported something */
3796+
/* return number of pdus sent */
37993797
static int netflow_scan_and_export(const int flush)
38003798
{
38013799
long i_timeout = inactive_timeout * HZ;
@@ -3929,15 +3927,15 @@ static void netflow_work_fn(void *dummy)
39293927
static void netflow_work_fn(struct work_struct *dummy)
39303928
#endif
39313929
{
3932-
int status;
3930+
int pdus;
39333931

39343932
wk_count = 0;
39353933
wk_trylock = 0;
39363934
wk_llist = 0;
39373935
wk_cpu = smp_processor_id();
39383936
wk_start = jiffies;
3939-
status = netflow_scan_and_export(DONT_FLUSH);
3940-
_schedule_scan_worker(status);
3937+
pdus = netflow_scan_and_export(DONT_FLUSH);
3938+
_schedule_scan_worker(pdus);
39413939
wk_busy = jiffies - wk_start;
39423940
}
39433941

0 commit comments

Comments
 (0)