summaryrefslogtreecommitdiffstats
path: root/common/sched.c
blob: 02582b2c5e4dadab0e17332541b73108d751a284 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* SPDX License Identifier: GPL-2.0 */

#include <bthread.h>
#include <poller.h>
#include <work.h>
#include <slice.h>
#include <sched.h>

void resched(void)
{
	bool run_workqueues = !slice_acquired(&command_slice);

	if (poller_active())
		return;

	command_slice_acquire();

	if (run_workqueues) {
		wq_do_all_works();
		bthread_reschedule();
	}

	poller_call();

	command_slice_release();
}