Age | Commit message (Collapse) | Author | Files | Lines |
|
- if someone adds a timed_event with a zero timeval
we now avoid serval gettimeofday() calls and the
event handler doesn't get the current time when it's
called, instead we also pass a zero timeval
- this also makes sure multiple timed events with a zero timeval
are processed in the order there're added.
the little benchmark shows that processing 2000000 directly timed events
is now much faster, while avoiding syscalls at all!
> time ./evtest (with the old code)
real 0m6.388s
user 0m1.740s
sys 0m4.632s
> time ./evtest (with the new code)
real 0m1.498s
user 0m1.496s
sys 0m0.004s
metze@SERNOX:~/devel/samba/4.0/samba4-ci/source> cat evtest.c
#include <stdio.h>
#include <stdint.h>
#include <sys/time.h>
#include <talloc.h>
#include <events.h>
static void dummy_fde_handler(struct event_context *ev_ctx, struct fd_event *fde,
uint16_t flags, void *private_data)
{
}
static void timeout_handler(struct event_context *ev, struct timed_event *te,
struct timeval tval, void *private_data)
{
uint32_t *countp = (uint32_t *)private_data;
(*countp)++;
if (*countp > 2000000) exit(0);
event_add_timed(ev, ev, tval, timeout_handler, countp);
}
int main(void)
{
struct event_context *ev;
struct timeval tval = { 0, 0 };
uint32_t count = 0;
ev = event_context_init(NULL);
event_add_fd(ev, ev, 0, 0, dummy_fde_handler, NULL);
event_add_timed(ev, ev, tval, timeout_handler, &count);
return event_loop_wait(ev);
}
(This used to be commit 4db64b4ce2320b88d648078cbf86385f6fb44f1f)
|
|
(This used to be commit b0c8c1cd21e3f91431504d70a4bc0d3c6dee6071)
|
|
event context is created. This allows the LOCAL-EVENT test to pass on
systems with have libaio but not the necessary kernel patches
(This used to be commit 2ff8abf0022824e6ae93019ee1b3391e651a8ee7)
|
|
If this happens:
- two sockets are readable, and select/epoll/aio returns both of
them
- read event on socket1 is called
- inside that read event an event_loop_once is called, this returns that
socket2 is readable
- read event on socket2 is called
- event_loop_once returns
- top level event handler then calls read event on socket2 (as it
still has that listed as readable)
- read handler for socket2 returns zero byte read, which is
interpreted as end of file
- socket is incorrectly closed
this happened with ctdb, but it could happen anywhere (just
rarely). The fix is trivial - ensure we break out of the event loop
when we have been called recursively.
(This used to be commit e042002bb5ee8974220e1ade56b64389571f75a6)
|
|
this is part of the solution to LOCAL-EVENT on fort
(This used to be commit 35f62bc12559e355d4ac73018afe255ea7c5866b)
|
|
Jeremy asked for this to allow Samba3 to use the Samba4 events library
see torture/local/event.c for an example
(This used to be commit 7e105482ff9a3da6b4708ff99a64f1881614fc5f)
|
|
- fix epoll configure checks for the epoll and aio
events backends
- we should only activate the epoll backend if sys/epoll.h
and epoll_create() are found
- we should only activate the aio backend if sys/epoll.h, epoll_create(),
libaio.h and io_getevents() are found
hopefully fix the build on 'bnhtest' in the build farm...
metze
(This used to be commit d46a5efb03ea1df50567cad00e1589870cdb31fe)
|
|
- allow the events backend to be chosen in smb.conf
(This used to be commit 4a8e07286f827a6f57b2c54d97d31172553ceb0d)
|
|
- make it easier to plug in a new events backend
- add simpler 'select' and 'epoll' backends
This is part of the effort to add good AIO support. The events_aio.c
backend is done, but sometimes dies with a SEGV, which is why it isn't
enabled yet.
(This used to be commit 934f18283dbc7958944931a93a854526bcd54884)
|
|
epoll. It is not linked in anywhere yet - I'm committing it in case
anyone else wants to have a look at it.
The concept is quite strange really, but it seems to be the only way
that Linux 2.6.x can currently use a unified event model allowing for
AIO events and socket events to be waited for by a single unified
event wait function. You setup a epoll system, then setup a weird aio
event that points at the epoll system, then use io_getevents() to
actually do the waiting.
I'm hoping that kevents or a proper integration of epoll will allow us
to avoid ths rather hackish scheme, but meanwhile this is the only
path to proper AIO in Samba on Linux (without a horrible signals mess)
(NOTE: this code requires some kernel patches to work at the moment)
(This used to be commit 195051fdee341e8d8cb76e5c91dcc0f6c246a870)
|