sched: reduce number of wakeup IPIs

Each time thread is woken on a remote cpu IPI is sent to a cpu the process
belongs too in order to run scheduler there. This causes a lot of IPIs
to be sent. We can avoid sending an IPI if we know that rescheduling
will happen on a remote cpu in a reasonable time frame.  Usually if cpu
is not idle the scheduler will run there in a reasonable time frame, but
there is a pathological case where there is only one running process on
a cpu and it never sleeps. To accommodate for this case this patch avoids
sending IPI only if there is more than one runnable processes on a remote
cpu which means that scheduler will run shortly to switch running threads.

Signed-off-by: Gleb Natapov <gleb@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
scripts: use items() instead of iteritems()

iteritems() was removed from Python 3. Use items() might slow it down
a little bit when running on Python 2, but give us the compatibility
of Python 3.

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
fs: fix namei lookup

On Linux, if we stat or lstat names like "/tmp/", we get the same result as if
we do it for "/tmp".

On OSv, stat works as expected, but lstat does not. This is because we have to
look at the last element of the path separately to see if it is a link, and we
do that by looking at the last "/" character. The current algorithm will treat
everything after the last "/" as the thing to look for. But in a directory like
"/tmp/", we would be looking for an empty string.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
loader.py: search absolute name as well

Signed-off-by: Asias He <asias@cloudius-systems.com>
epoll: Fix event == nullptr
vfs: Add trace for sendfile

Signed-off-by: Asias He <asias@cloudius-systems.com>
Hack sendfile